public void TestAdd() { // 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 registration registration.Add(new DirectRegistration <DummyService>()); // assert that item count increased Assert.Equal(2, registration.Registrations.Count); }
public void TestAddInconsistent() { // create registration var registration = new MultiRegistration(new[] { new DirectRegistration <DummyService>().AsTransient() }); // assert that there is only a single item in the registration Assert.Single(registration.Registrations); // Add new registration Assert.Throws <InvalidOperationException>( () => registration.Add(new DirectRegistration <DummyService>().AsScoped())); // assert that there is only a single item in the registration Assert.Single(registration.Registrations); }