public void GetReflectionType_InvokeTypeObjectWithoutParent_ReturnsExpected(Type objectType, object instance)
        {
            var provider = new SubTypeDescriptionProvider();

            Assert.Same(objectType, provider.GetReflectionType(objectType, instance));

            // Call again.
            Assert.Same(objectType, provider.GetReflectionType(objectType, instance));
        }
        public void GetReflectionType_NullInstanceWithParent_ThrowsArgumentNullException()
        {
            var mockParentProvider = new Mock <TypeDescriptionProvider>(MockBehavior.Strict);
            var provider           = new SubTypeDescriptionProvider(mockParentProvider.Object);

            AssertExtensions.Throws <ArgumentNullException>("instance", () => provider.GetReflectionType((object)null));
        }
        public void GetReflectionType_InvokeTypeObjectWithParent_ReturnsExpected(Type objectType, object instance, Type result)
        {
            var mockParentProvider = new Mock <TypeDescriptionProvider>(MockBehavior.Strict);

            mockParentProvider
            .Setup(p => p.GetReflectionType(objectType, instance))
            .Returns(result)
            .Verifiable();
            var provider = new SubTypeDescriptionProvider(mockParentProvider.Object);

            Assert.Same(result, provider.GetReflectionType(objectType, instance));
            mockParentProvider.Verify(p => p.GetReflectionType(objectType, instance), Times.Once());

            // Call again.
            Assert.Same(result, provider.GetReflectionType(objectType, instance));
            mockParentProvider.Verify(p => p.GetReflectionType(objectType, instance), Times.Exactly(2));
        }
        public void GetReflectionType_NullInstance_ThrowsArgumentNullException()
        {
            var provider = new SubTypeDescriptionProvider();

            AssertExtensions.Throws <ArgumentNullException>("instance", () => provider.GetReflectionType((object)null));
        }