示例#1
0
        public void SucceedsWhenValueIsPresentUsingContainKey()
        {
            var dictionary = new Dictionary <string, string> {
                { "Hello", "World" }, { "Hola", "Mundo" }
            };

            Assert.That(dictionary, Does.ContainValue("Mundo"));
        }
示例#2
0
        public void Assert_does_contain_key_and_value()
        {
            var people = new Dictionary <string, int>()
            {
                ["carlos"] = 29, ["Jazzy"] = 9
            };

            Assert.That(people, Does.ContainKey("carlos"));
            Assert.That(people, Does.ContainValue(30));
        }
示例#3
0
        public void AssertThat_DoesCommonlyUsed()
        {
            var valuesByCountry = new Dictionary <string, int>
            {
                { "UK", 1000 },
                { "Spain", 2000 },
                { "France", 3000 }
            };

            Assert.That(valuesByCountry, Does.ContainKey("UK"));
            Assert.That(valuesByCountry, Does.ContainValue(3000));
        }
示例#4
0
        public void Given_MultipleComponents_When_Host_Then_NewHostRegisteredWithComponents()
        {
            var componentName          = "Component";
            var component              = A.Dummy <Components.IComponent>();
            var componentSpecification = A.Dummy <IGenericHostComponentSpecification>();

            A.CallTo(() => componentSpecification.Apply(A <IHostBuilder> ._)).Returns(component);
            A.CallTo(() => componentSpecification.Name).Returns(componentName);

            var spec = new GenericHostSpecification();

            spec.AddComponentSpecification(componentSpecification);

            var host = spec.Build();

            Assert.That(host, Is.Not.Null);
            Assert.That(host.Components, Does.ContainKey(componentName));
            Assert.That(host.Components, Does.ContainValue(component));
        }