Пример #1
0
        public void IsSupportedType_InvokeWithoutParent_ReturnsTrue(Type type)
        {
            var provider = new SubTypeDescriptionProvider();

            Assert.True(provider.IsSupportedType(type));

            // Call again.
            Assert.True(provider.IsSupportedType(type));
        }
Пример #2
0
        public void IsSupportedType_NullTypeWithParent_ThrowsArgumentNullException()
        {
            var mockParentProvider = new Mock <TypeDescriptionProvider>(MockBehavior.Strict);
            var provider           = new SubTypeDescriptionProvider(mockParentProvider.Object);

            AssertExtensions.Throws <ArgumentNullException>("type", () => provider.IsSupportedType(null));
        }
Пример #3
0
        public void IsSupportedType_InvokeWithParent_ReturnsExpected(Type type, bool result)
        {
            var mockParentProvider = new Mock <TypeDescriptionProvider>(MockBehavior.Strict);

            mockParentProvider
            .Setup(p => p.IsSupportedType(type))
            .Returns(result)
            .Verifiable();
            var provider = new SubTypeDescriptionProvider(mockParentProvider.Object);

            Assert.Equal(result, provider.IsSupportedType(type));
            mockParentProvider.Verify(p => p.IsSupportedType(type), Times.Once());

            // Call again.
            Assert.Equal(result, provider.IsSupportedType(type));
            mockParentProvider.Verify(p => p.IsSupportedType(type), Times.Exactly(2));
        }
Пример #4
0
        public void IsSupportedType_NullType_ThrowsArgumentNullException()
        {
            var provider = new SubTypeDescriptionProvider();

            AssertExtensions.Throws <ArgumentNullException>("type", () => provider.IsSupportedType(null));
        }