public void TestAddRange() { // create registration var registration = new MultiRegistration(new[] { new DirectRegistration <DummyService>() }); // assert that there is only a single item in the registration Assert.Single(registration.Registrations); // Add new registrations registration.AddRange((IEnumerable <IServiceRegistration>) new[] { new DirectRegistration <DummyService>(), new DirectRegistration <DummyService>() }); // assert that item count increased Assert.Equal(3, registration.Registrations.Count); }
public void TestAddRangeInconsistent() { // create registration var registration = new MultiRegistration(new[] { new DirectRegistration <DummyService>().AsSingleton() }); // assert that there is only a single item in the registration Assert.Single(registration.Registrations); // Add new registrations Assert.Throws <InvalidOperationException>( () => registration.AddRange((IEnumerable <IServiceRegistration>) new[] { new DirectRegistration <DummyService>().AsScoped(), new DirectRegistration <DummyService>().AsTransient() })); // assert that there is only a single item in the registration Assert.Single(registration.Registrations); }