Пример #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));
        }