public void RemoveAt_GuardClauses() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); // Act & assert ExceptionAssert.ThrowsArgumentNull(() => defaultServices.RemoveAt(serviceType: null, index: 0), "serviceType"); ExceptionAssert.ThrowsArgument(() => defaultServices.RemoveAt(typeof(object), 0), "serviceType"); ExceptionAssert.ThrowsArgumentOutOfRange(() => defaultServices.RemoveAt(typeof(IFilterProvider), -1), "index"); }
public void RemoteAt_RemovesService() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); var filterProvider1 = new Mock <IFilterProvider>().Object; var filterProvider2 = new Mock <IFilterProvider>().Object; defaultServices.ReplaceRange(typeof(IFilterProvider), new[] { filterProvider1, filterProvider2 }); // Act defaultServices.RemoveAt(typeof(IFilterProvider), 1); // Assert Assert.Equal(new[] { filterProvider1 }, defaultServices.GetServices(typeof(IFilterProvider))); }
public void RemoteAt_RemovesService() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); var filterProvider1 = new Mock<IFilterProvider>().Object; var filterProvider2 = new Mock<IFilterProvider>().Object; defaultServices.ReplaceRange(typeof(IFilterProvider), new[] { filterProvider1, filterProvider2 }); // Act defaultServices.RemoveAt(typeof(IFilterProvider), 1); // Assert Assert.Equal(new[] { filterProvider1 }, defaultServices.GetServices(typeof(IFilterProvider))); }