public void Test_EnsureAuthorised_AllowPublicType() { CreateController controller = new CreateController(); controller.Container = new MockCreateProjection(typeof(MockPublicEntity)); bool isAuthorised = controller.EnsureAuthorised(); Assert.IsTrue(isAuthorised, "Returned false when it should be true."); }
public void Test_EnsureAuthorised_RestrictUnauthorisedType() { MockRestrictedEntity restrictedEntity = new MockRestrictedEntity(); CreateController controller = new CreateController(); controller.Container = new MockCreateProjection(typeof(MockRestrictedEntity)); bool isAuthorised = controller.EnsureAuthorised(); Assert.IsFalse(isAuthorised, "Returned true when it should have been false."); }
/// <summary> /// Creates a new create controller. /// </summary> /// <param name="container"></param> /// <returns></returns> public static CreateController New(IControllable container) { CreateController controller = null; using (LogGroup logGroup = LogGroup.Start("Instantiating a new create controller.", NLog.LogLevel.Debug)) { controller = ControllerState.Controllers.Creator.New <CreateController>(container); LogWriter.Debug("Type name: " + container.Command.TypeName); } return(controller); }
public void Test_IsController() { ControllerScanner scanner = new ControllerScanner(); CreateController controller = new CreateController(); bool isController = scanner.IsController(controller.GetType()); Assert.IsTrue(isController, "CreateController class is not recognised as a controller as it should be."); }