コード例 #1
0
        public void AggProperties_NullOrEmptyList()
        {
            // 1. Null -> error
            AssertException.Expects <ArgumentNullException>(() => new AggregatePropertiesProvider(null));

            // 2. Empty list of providers -> valid but returns nothing
            var provider = new AggregatePropertiesProvider(new IAnalysisPropertyProvider[] { });

            Assert.AreEqual(0, provider.GetAllProperties().Count());
            var success = provider.TryGetProperty("any key", out Property actualProperty);

            Assert.IsFalse(success, "Not expecting a property to be returned");
            Assert.IsNull(actualProperty, "Returned property should be null");
        }
        public void AggProperties_NullOrEmptyList()
        {
            // 1. Null -> error
            Action act = () => new AggregatePropertiesProvider(null); act.Should().ThrowExactly <ArgumentNullException>();

            // 2. Empty list of providers -> valid but returns nothing
            var provider = new AggregatePropertiesProvider(new IAnalysisPropertyProvider[] { });

            provider.GetAllProperties().Should().BeEmpty();
            var success = provider.TryGetProperty("any key", out var actualProperty);

            success.Should().BeFalse("Not expecting a property to be returned");
            actualProperty.Should().BeNull("Returned property should be null");
        }
        public void AggProperties_NullOrEmptyList()
        {
            // 1. Null -> error
            AssertException.Expects<ArgumentNullException>(() => new AggregatePropertiesProvider(null));

            // 2. Empty list of providers -> valid but returns nothing
            AggregatePropertiesProvider provider = new AggregatePropertiesProvider(new IAnalysisPropertyProvider[] { });

            Assert.AreEqual(0, provider.GetAllProperties().Count());
            Property actualProperty;
            bool success = provider.TryGetProperty("any key", out actualProperty);

            Assert.IsFalse(success, "Not expecting a property to be returned");
            Assert.IsNull(actualProperty, "Returned property should be null");
        }