Exemple #1
0
            public void CanBuildType_WithNoDependencies()
            {
                var sut   = new BaseUnitTest <TestableTypeNoDependencies>();
                var built = sut.Build();

                Assert.NotNull(sut.ClassUnderTest);
            }
Exemple #2
0
            public void CanBuildType_WithAbstractDependencies()
            {
                var sut   = new BaseUnitTest <TypeWithAbstractDependcies>();
                var built = sut.Build();

                Assert.NotNull(sut.ClassUnderTest);
            }
Exemple #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);
            }
Exemple #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);
            }