Exemplo n.º 1
0
        public void GetCache_InvokeWithoutParent_ReturnsNull(object instance)
        {
            var provider = new SubTypeDescriptionProvider();

            Assert.Null(provider.GetCache(instance));

            // Call again.
            Assert.Null(provider.GetCache(instance));
        }
Exemplo n.º 2
0
        public void GetCache_InvokeWithParent_ReturnsExpected(object instance, IDictionary result)
        {
            var mockParentProvider = new Mock <TypeDescriptionProvider>(MockBehavior.Strict);

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

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

            // Call again.
            Assert.Same(result, provider.GetCache(instance));
            mockParentProvider.Verify(p => p.GetCache(instance), Times.Exactly(2));
        }