public void Remove_GuardClauses() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); // Act & assert ExceptionAssert.ThrowsArgumentNull(() => defaultServices.Remove(serviceType: null, service: new object()), "serviceType"); ExceptionAssert.ThrowsArgumentNull(() => defaultServices.Remove(typeof(object), service: null), "service"); ExceptionAssert.ThrowsArgument(() => defaultServices.Remove(typeof(object), new object()), "serviceType"); }
public void Remove_ObjectFound() { // 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.Remove(typeof(IFilterProvider), filterProvider1); // Assert Assert.Equal(new[] { filterProvider2 }, defaultServices.GetServices(typeof(IFilterProvider))); }
public void Remove_ObjectNotFound() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); var filterProvider1 = new Mock<IFilterProvider>().Object; var filterProvider2 = new Mock<IFilterProvider>().Object; var notPresentFilterProvider = new Mock<IFilterProvider>().Object; defaultServices.ReplaceRange(typeof(IFilterProvider), new[] { filterProvider1, filterProvider2 }); // Act defaultServices.Remove(typeof(IFilterProvider), notPresentFilterProvider); // Assert Assert.Equal(new[] { filterProvider1, filterProvider2 }, defaultServices.GetServices(typeof(IFilterProvider))); }
public void Remove_GuardClauses() { // Arrange var config = new ProcessorConfiguration(); var defaultServices = new DefaultServices(config); // Act & assert ExceptionAssert.ThrowsArgumentNull(() => defaultServices.Remove(serviceType: null, service: new object()), "serviceType"); ExceptionAssert.ThrowsArgumentNull(() => defaultServices.Remove(typeof(object), service: null), "service"); ExceptionAssert.ThrowsArgument(() => defaultServices.Remove(typeof(object), new object()), "serviceType"); }