public void CastToBaseType_ReturnTrue()
            {
                var candidate     = new ChildFakeType();
                var specification = MockSpecification <FakeType> .True();

                var sut = new CastSpecification <ChildFakeType, FakeType>(specification);

                var result = sut.IsSatisfiedBy(candidate);

                Assert.True(result);
            }
コード例 #2
0
            public void InvokeCastToBaseType_ReturnTrue()
            {
                var candidate     = new ChildFakeType();
                var specification = MockSpecification <FakeType> .True();

                var sut = new CastSpecification <ChildFakeType, FakeType>(specification);

                var result = sut.GetExpression().Compile().Invoke(candidate);

                Assert.True(result);
            }
            public void CastToBaseType_ReturnExpectedResultObject()
            {
                var candidate     = new ChildFakeType();
                var specification = MockSpecification <FakeType> .True();

                var expected = new SpecificationResult(2, true,
                                                       "CastSpecification<ChildFakeType,FakeType>(TrueMockSpecification<FakeType>)");
                var sut = new CastSpecification <ChildFakeType, FakeType>(specification);

                var overall = sut.IsSatisfiedBy(candidate, out var result);

                Assert.True(overall);
                Assert.Equal(expected, result, new SpecificationResultComparer());
            }