コード例 #1
0
        public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException()
        {
            // Arrange
            var sut = new DirectBaseTypeSpecification(typeof(object));

            // Act & assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.IsSatisfiedBy(null));
        }
コード例 #2
0
        public void SutIsRequestSpecification()
        {
            // Arrange
            // Act
            var sut = new DirectBaseTypeSpecification(typeof(object));

            // Assert
            Assert.IsAssignableFrom <IRequestSpecification>(sut);
        }
コード例 #3
0
        public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException()
        {
            // Fixture setup
            var sut = new DirectBaseTypeSpecification(typeof(object));

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.IsSatisfiedBy(null));
            // Teardown
        }
コード例 #4
0
        public void SutIsRequestSpecification()
        {
            // Fixture setup
            // Exercise system
            var sut = new DirectBaseTypeSpecification(typeof(object));

            // Verify outcome
            Assert.IsAssignableFrom <IRequestSpecification>(sut);
            // Teardown
        }
コード例 #5
0
        public void InitializeWithTargetTypeShouldSetCorrespondingProperty()
        {
            // Arrange
            var targetType = typeof(object);
            // Act
            var sut = new DirectBaseTypeSpecification(targetType);

            // Assert
            Assert.Equal(targetType, sut.TargetType);
        }
コード例 #6
0
        public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request)
        {
            // Arrange
            var sut = new DirectBaseTypeSpecification(typeof(ConcreteType));
            // Act
            var result = sut.IsSatisfiedBy(request);

            // Assert
            Assert.False(result);
        }
コード例 #7
0
        public void InitializeWithTargetTypeShouldSetCorrespondingProperty()
        {
            // Fixture setup
            var targetType = typeof(object);
            // Exercise system
            var sut = new DirectBaseTypeSpecification(targetType);

            // Verify outcome
            Assert.Equal(targetType, sut.TargetType);
            // Teardown
        }
コード例 #8
0
        public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request)
        {
            // Fixture setup
            var sut = new DirectBaseTypeSpecification(typeof(ConcreteType));
            // Exercise system
            var result = sut.IsSatisfiedBy(request);

            // Verify outcome
            Assert.False(result);
            // Teardown
        }
コード例 #9
0
        public void IsSatisfiedByWithRequestForIncompatibleTypeShouldReturnFalse()
        {
            // Arrange
            var targetType    = typeof(ConcreteType);
            var requestedType = typeof(string);
            var sut           = new DirectBaseTypeSpecification(targetType);
            // Act
            var result = sut.IsSatisfiedBy(requestedType);

            // Assert
            Assert.False(result);
        }
コード例 #10
0
        public void IsSatisfiedByWithRequestForDirectBaseTypeShouldReturnTrue()
        {
            // Arrange
            var targetType    = typeof(ConcreteType);
            var requestedType = typeof(AbstractType);
            var sut           = new DirectBaseTypeSpecification(targetType);
            // Act
            var result = sut.IsSatisfiedBy(requestedType);

            // Assert
            Assert.True(result);
        }
コード例 #11
0
        public void IsSatisfiedByWithRequestForIndirectBaseTypeShouldReturnFalse()
        {
            // Fixture setup
            var targetType    = typeof(ConcreteType);
            var requestedType = typeof(object);
            var sut           = new DirectBaseTypeSpecification(targetType);
            // Exercise system
            var result = sut.IsSatisfiedBy(requestedType);

            // Verify outcome
            Assert.False(result);
            // Teardown
        }