public void ValidationContext_Can_Add_And_Get_Service() { ValidationContext context = new ValidationContext(this, null, null); MyTestService service = new MyTestService(); context.ServiceContainer.AddService(service.GetType(), service); Assert.AreSame(service, context.GetService(service.GetType())); }
public void ValidationContext_Allows_Services_To_Explicitly_Promote_To_Parent() { MyServiceContainer container = new MyServiceContainer(); ValidationContext context = new ValidationContext(this, container, null); MyTestService service = new MyTestService(); context.ServiceContainer.AddService(service.GetType(), service, true); // Explicit promotion Assert.AreSame(service, container.GetService(service.GetType())); }
public void ValidationContext_Allows_Services_To_Not_Promote_To_Parent_Container() { MyServiceContainer container = new MyServiceContainer(); ValidationContext context = new ValidationContext(this, container, null); MyTestService service = new MyTestService(); context.ServiceContainer.AddService(service.GetType(), service, false); Assert.IsNull(container.GetService(service.GetType())); }
public void ValidationContext_Can_Accept_Container_And_Return_Service_From_GetService() { MyServiceContainer container = new MyServiceContainer(); MyTestService service = new MyTestService(); container.AddService(service.GetType(), service); ValidationContext context = new ValidationContext(this, container, null); Assert.AreSame(service, context.GetService(service.GetType())); }