Example #1
0
            public void Instances_AreSingletons()
            {
                var sut    = new BaseUnitTest <TypeWithInterfaceDependencies>();
                var first  = sut.Mock <IBarService>();
                var second = sut.Mock <IBarService>();

                Assert.Equal(first, second);
            }
Example #2
0
            public void CanGet_TheMock()
            {
                var sut  = new BaseUnitTest <TypeWithInterfaceDependencies>();
                var mock = sut.Mock <IFooService>();

                Assert.NotNull(mock);
                Assert.IsType <Mock <IFooService> >(mock);
            }
Example #3
0
            public void Instances_AreSameAsSystemUnderTest()
            {
                var sut    = new BaseUnitTest <TypeWithInterfaceDependencies>();
                var first  = sut.Mock <IFooService>();
                var second = sut.Build().FooService;

                Assert.Equal(first.Object, second);
            }
Example #4
0
            public void CanSetup_TheMock()
            {
                var sut        = new BaseUnitTest <TypeWithInterfaceDependencies>();
                var testObject = sut.Build();

                var initial = testObject.FooService.Name();

                var mock     = sut.Mock <IFooService>();
                var expected = "hello";

                mock.Setup(foo => foo.Name()).Returns(expected);

                var result = testObject.FooService.Name();

                Assert.NotEqual(expected, initial);
                Assert.Equal(expected, result);
            }
Example #5
0
 public void CanGetInstance()
 {
     var sut = new BaseUnitTest <TypeWithInterfaceDependencies>();
     var bar = sut.Mock <IBarService>();
 }