示例#1
0
        private void ExecuteSetup(SetupXml setup)
        {
            try
            {
                foreach (var command in setup.Commands)
                {
                    var skip = false;
                    if (command is IGroupCommand)
                    {
                        var groupCommand = (command as IGroupCommand);
                        if (groupCommand.RunOnce)
                        {
                            skip = groupCommand.HasRun;
                        }
                    }

                    if (!skip)
                    {
                        var impl = new DecorationFactory().Get(command);
                        impl.Execute();
                        if (command is IGroupCommand)
                        {
                            var groupCommand = (command as IGroupCommand);
                            groupCommand.HasRun = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                HandleExceptionDuringSetup(ex);
            }
        }
示例#2
0
        public void Get_IDecorationConditionArgs_CorrectCondition(Type argsType, Type conditionType)
        {
            var args = GetConditionArgsMock(argsType);

            var factory = new DecorationFactory();
            var command = factory.Instantiate(args);

            Assert.That(command, Is.TypeOf(conditionType));
        }
示例#3
0
        public Controller()
        {
            this.decorationRepository = new DecorationRepository();
            this.aquariumRepository   = new AquariumRepository();

            this.aquariumFactory   = new AquariumFactory();
            this.decorationFactory = new DecorationFactory();
            this.fishFactory       = new FishFactory();
        }
示例#4
0
文件: TestSuite.cs 项目: kalyon/NBi
 private void ExecuteChecks(ConditionXml check)
 {
     foreach (var predicate in check.Predicates)
     {
         var impl       = new DecorationFactory().Get(predicate);
         var isVerified = impl.Validate();
         if (!isVerified)
         {
             Assert.Ignore("This test has been ignored because following check wasn't successful: {0}", impl.Message);
         }
     }
 }
示例#5
0
 private void ExecuteChecks(ConditionXml check)
 {
     foreach (var predicate in check.Predicates)
     {
         var impl       = new DecorationFactory().Get(predicate);
         var isVerified = impl.Validate();
         if (!isVerified)
         {
             Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceInfo, $"Test ignored. At least one condition was not validated: '{impl.Message}'");
             Assert.Ignore($"This test has been ignored because following check wasn't successful: {impl.Message}");
         }
     }
 }
示例#6
0
 private void ExecuteCleanup(CleanupXml cleanup)
 {
     try
     {
         foreach (var command in cleanup.Commands)
         {
             var impl = new DecorationFactory().Get(command);
             impl.Execute();
         }
     }
     catch (Exception ex)
     {
         HandleExceptionDuringCleanup(ex);
     }
 }
示例#7
0
 private void ValidateConditions(ConditionXml condition, IDictionary <string, ITestVariable> allVariables)
 {
     foreach (var predicate in condition.Predicates)
     {
         var helper     = new ConditionHelper(serviceLocator, allVariables);
         var args       = helper.Execute(predicate);
         var impl       = new DecorationFactory().Instantiate(args);
         var isVerified = impl.Validate();
         if (!isVerified)
         {
             Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, $"Test ignored. At least one condition was not validated: '{impl.Message}'");
             Assert.Ignore($"This test has been ignored because following check wasn't successful: {impl.Message}");
         }
     }
 }
        public void NullObjectDemo()
        {
            Form1.commandLogger.logMessage(AbstractLogger.TEST, "\t\nNull Object Test:\n\n");
            DecorationFactory df = new DecorationFactory();

            IDecoration deco1 = df.GetDecoration("Leaf");
            IDecoration deco2 = df.GetDecoration("Tree");
            IDecoration deco3 = df.GetDecoration("Water");
            IDecoration deco4 = df.GetDecoration("House");

            Form1.commandLogger.logMessage(AbstractLogger.TEST, "Get decoration: Leaf\n");
            Form1.commandLogger.logMessage(AbstractLogger.TEST, "Get decoration: Tree\n");
            Form1.commandLogger.logMessage(AbstractLogger.TEST, "Get decoration: Water\n");
            Form1.commandLogger.logMessage(AbstractLogger.TEST, "Get decoration: House\n");
            Form1.commandLogger.logMessage(AbstractLogger.TEST, deco1.IsNull() + " " + deco2.IsNull() + " " + deco3.IsNull() + " " + deco4.IsNull() + "\n\n");
        }
示例#9
0
        private void ExecuteCleanup(CleanupXml cleanup, IDictionary <string, ITestVariable> allVariables)
        {
            var cleanupHelper = new SetupHelper(serviceLocator, allVariables);
            var commands      = cleanupHelper.Execute(cleanup.Commands);

            try
            {
                foreach (var command in commands)
                {
                    var impl = new DecorationFactory().Instantiate(command);
                    impl.Execute();
                }
            }
            catch (Exception ex)
            {
                HandleExceptionDuringCleanup(ex);
            }
        }
示例#10
0
        private void ExecuteSetup(SetupXml setup, IDictionary <string, ITestVariable> allVariables)
        {
            var setupHelper = new SetupHelper(serviceLocator, allVariables);
            var commands    = setupHelper.Execute(setup.Commands);

            try
            {
                foreach (var command in commands)
                {
                    var skip = false;
                    if (command is IGroupCommand)
                    {
                        var groupCommand = (command as IGroupCommand);
                        if (groupCommand.RunOnce)
                        {
                            skip = groupCommand.HasRun;
                        }
                    }

                    if (!skip)
                    {
                        var impl = new DecorationFactory().Instantiate(command);
                        impl.Execute();
                        if (command is IGroupCommand)
                        {
                            var groupCommand = (command as IGroupCommand);
                            groupCommand.HasRun = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                HandleExceptionDuringSetup(ex);
            }
        }