Example #1
0
        public void CommandBase_AssertDefaultValues()
        {
            var cmd = new CommandObject();

              Assert.AreEqual(string.Empty, cmd.Name);
              Assert.AreEqual(0, cmd.Num);
        }
Example #2
0
        public void CommandBase_CanLoadProperties_WithObjectFactory()
        {
            var cmd = new CommandObject();

              LoadProperty(cmd, CommandObject.NameProperty, "Rocky");
              LoadProperty(cmd, CommandObject.NumProperty, 8);

              Assert.AreEqual("Rocky", cmd.Name);
              Assert.AreEqual(8, cmd.Num);
        }
Example #3
0
        public void CommandBase_CanLoadPropertiesUsingNonGenericPropertyInfo_WithObjectFactory()
        {
            var cmd = new CommandObject();

              IPropertyInfo nameProperty = (IPropertyInfo) CommandObject.NameProperty;
              IPropertyInfo numProperty = (IPropertyInfo)CommandObject.NumProperty;

              LoadProperty(cmd, nameProperty, "Rocky");
              LoadProperty(cmd, numProperty, 8);

              Assert.AreEqual("Rocky", cmd.Name);
              Assert.AreEqual(8, cmd.Num);
        }
 public void ExecuteCommand_called_without_UserState_results_in_UserState_defaulted_to_Null_server()
 {
   var context = GetContext();
   var command = new CommandObject();
   command.ExecuteServerCodeAsunch((o1, e1) =>
                                     {
                                       context.Assert.IsNull(e1.Error);
                                       context.Assert.AreEqual("Executed", e1.Object.AProperty);
                                       context.Assert.IsNull(e1.UserState);
                                       context.Assert.Success();
                                     });
   context.Complete();
 }
 public void ExecuteCommand_called_with_UserState_results_in_UserState_set_on_server()
 {
   var context = GetContext();
   object userState = "state";
   var command = new CommandObject();
   command.ExecuteServerCodeAsunch((o1, e1) =>
                                     {
                                       context.Assert.IsNull(e1.Error);
                                       context.Assert.AreEqual("Executed", e1.Object.AProperty);
                                       context.Assert.AreEqual(userState, e1.UserState);
                                       context.Assert.Success();
                                     }, userState);
   context.Complete();
 }
Example #6
0
 public object Execute(CommandObject command)
 {
     command.Result = true;
       return command;
 }
Example #7
0
 public void TestCommandBase()
 {
     Csla.ApplicationContext.GlobalContext.Clear();
     CommandObject obj = new CommandObject();
     Assert.AreEqual("Executed", obj.ExecuteServerCode().AProperty);
 }
 public void ExecuteOn(int commandOnPosition)
 {
     if (PositionOutOfList(commandOnPosition, commandOnList))
     {
         nullCommand.Execute();
         lastCommand = nullCommand;
         lifoCommandList.Add(nullCommand);
         return;
     }
     commandOnList[commandOnPosition].Execute();
     lastCommand = commandOffList[commandOnPosition];
     lifoCommandList.Add(commandOnList[commandOnPosition]);
 }
 public void AddActionOn(CommandObject commandOn)
 {
     commandOnList.Add(commandOn);
 }
 public void AddActionOff(CommandObject commandOff)
 {
     commandOffList.Add(commandOff);
 }