public void WhenTryToRegisterMultipleTimesTheSameService_ThrowAnException() { var serviceLocator = new Services.ServiceLocator.ServiceLocator(); var service = new TestService1(); serviceLocator.Register <ITestService>(service); Assert.Throws <ArgumentException>(() => serviceLocator.Register <ITestService>(service)); }
public void WhenRegisterAServiceAndTryToGetIt_ReturnTheRegisteredService() { var serviceLocator = new Services.ServiceLocator.ServiceLocator(); var service = new TestService1(); serviceLocator.Register <ITestService>(service); Assert.AreEqual(service, serviceLocator.Get <ITestService>()); }