chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
Hello,

I have a WCF service in which I have set up a Mock on my Entity it works well as long as I reference my dll
Now I would go further and directly referencing my service ".svc" and indicate to the execution of my service I want to distort my Entity via a method

public enum TestContext
{
      Default
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class ExampleService : IExample
{
public void TestContext(TestContext testContext)
{
      MockService.Initialize(testContext);
}
}

with
public static class MockService
    {
        public static void Initialize(TestContext testContext)
        {
            var dataTiers = new List<TIERS>
            {
                new TIERS {ID_TIERS = 1}
            }.AsQueryable();

var context = Isolate.Fake.AllInstances<EntityContainer>();
            Isolate.WhenCalled(() => context.TIERS).WillReturnCollectionValuesOf(dataTiers);
     }
}

My problem is Isolate is not started because the service is independent of the unit test
(I saw it was possible to launch TMockRunner but it always seems couple with unit test)

So it is possible to launch Isolate via the dll of my service directly?

Thx
asked by (3.1k points)

1 Answer

0 votes
Hi,

Isolator is a mocking tool dedicated to unit testing.
If you are trying to use Isolator to intercept methods in other contexts you should try using CThru which is an AOP interception framework based on the Typemock Open-AOP API.

Otherwise, please explain which capabilities of Isolator you need.
answered by (3.6k points)
...