Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:42:18+00:00 2026-06-07T12:42:18+00:00

How do I create unit test with context based on integration component? I have

  • 0

How do I create unit test with context based on integration component?

I have identified problem as the Extension is trying to resolve implementation and returning error message:

“Object reference not set to an instance of an object.”

My class:

 public sealed class GetListOfServiceIdsToProcess
{
   public InOutArgument<IArguments> Arguments { get; set; }

    protected override void Execute(CodeActivityContext context)
    {

        // I am recieving my error exception here
        context.GetExtension<lib.Extension.MyExtenstion>();

        var targetIds= (List<int>)Settings.Get("targetIds");

        var wfa = this.Arguments.Get(context);
        wfa.ListTargetIds = targetIds;

        Arguments.Set(context, wfa);            
    }
}

My Test so far:

I have problem with implementation of the test as far i could get it:

    /// <summary>
    ///A test for Execute
    ///</summary>
    [TestMethod()]
    public void ExecuteTest()
    {
        // create Isettings mock to return collection of service ids

        var expected = new List<int>() { 30, 20 };

        var wfaInput = new TestWorkFlow();

        var serviceIdList = new GetListOfServiceIdsToProcess();
        var wfParam = new Dictionary<string, object>();
        wfParam.Add("WorkFlowArguments", wfaInput);

        var results = WorkflowInvoker.Invoke(serviceIdList, wfParam);
        var wfaResult = (IWorkFlowArguments)results["WorkFlowArguments"];

        Assert.AreEqual(expected, wfaResult.ListOfServiceIdsToProcess);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:42:23+00:00Added an answer on June 7, 2026 at 12:42 pm

    I have run through multiple options and the problem what I have is MS Workflow.
    I have extracted all logic away from workflow code activity into separate class and this class has been put under tests.

    This is the best I could do for this. As I have base classes, that are injected, but I could not easily implement what I needed.

    Thank you all for help anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Visual Studio 2008 has the ability to automatically create unit test stubs. I have
I want to create a unit test for integration testing. What class should I
I am trying to create a unit test for a method that takes a
Specifically, I'm trying to create a unit test for a method which requires uses
I'm trying to create a mock HttpContextBase for unit test. var fakePrinciple = new
I try to create unit test cases to check my table values are correct
The fundamental question is how do I create a unit test that needs to
In both VSTS 2008 and VS 2010 RC1 when I create a Unit Test
I am using VS2010 to create a new unit test project to test my
In order to automate unit tests on TeamCity I had to create a test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.