コード例 #1
0
            public void NullCandidate_NoException()
            {
                var sut = new MockCommonSpecification <object>();

                var exception = Record.Exception(() => sut.IsSatisfiedBy(null, out _));

                Assert.Null(exception);
            }
コード例 #2
0
            public void Nullable_ReturnFalse()
            {
                var sut = new MockCommonSpecification <int?>();

                var result = sut.IsSatisfiedBy(0);

                Assert.False(result);
            }
コード例 #3
0
            public void IncorrectData_ReturnFalse <T>(T candidate)
            {
                var sut = new MockCommonSpecification <T>();

                var result = sut.IsSatisfiedBy(candidate);

                Assert.False(result);
            }
コード例 #4
0
            public void IncorrectData_ReturnExpectedResultObject <T>(T candidate, SpecificationResult expected)
            {
                var sut = new MockCommonSpecification <T>();

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

                Assert.False(overall);
                Assert.Equal(expected, result, new SpecificationResultComparer());
            }
コード例 #5
0
            public void Nullable_ReturnExpectedResultObject()
            {
                var expected = new SpecificationResult(false, "MockCommonSpecification<Nullable<Int32>>+Failed",
                                                       new FailedSpecification(typeof(MockCommonSpecification <int?>), 0, "Not match"));
                var sut = new MockCommonSpecification <int?>();

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

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