Example #1
0
        public void HasRegistration_returns_false_if_no_contained_provider_has_the_key(IServiceRegistrationProvider[] providers,
                                                                                       ServiceRegistrationKey key)
        {
            // Arrange
            Mock.Get(providers[0]).Setup(x => x.HasRegistration(key)).Returns(false);
            Mock.Get(providers[1]).Setup(x => x.HasRegistration(key)).Returns(false);
            Mock.Get(providers[2]).Setup(x => x.HasRegistration(key)).Returns(false);
            var sut = new StackOfRegistriesRegistrationProvider(providers);

            // Act
            var result = sut.HasRegistration(key);

            // Assert
            Assert.That(result, Is.False);
        }
Example #2
0
        public void HasRegistration_returns_true_if_any_contained_provider_has_the_registration(IServiceRegistrationProvider[] providers,
                                                                                                IServiceRegistration registration)
        {
            // Arrange
            Mock.Get(providers[0]).Setup(x => x.HasRegistration(registration)).Returns(false);
            Mock.Get(providers[1]).Setup(x => x.HasRegistration(registration)).Returns(true);
            Mock.Get(providers[2]).Setup(x => x.HasRegistration(registration)).Returns(false);
            var sut = new StackOfRegistriesRegistrationProvider(providers);

            // Act
            var result = sut.HasRegistration(registration);

            // Assert
            Assert.That(result, Is.True);
        }