Exemple #1
0
        public void Serialize_CustomWithParameters_Correct()
        {
            var root = new ConditionXml()
            {
                Predicates = new List <DecorationConditionXml>()
                {
                    new CustomConditionXml()
                    {
                        AssemblyPath = "myAssembly.dll",
                        TypeName     = "myType",
                        Parameters   = new List <CustomConditionParameterXml>()
                        {
                            new CustomConditionParameterXml()
                            {
                                Name = "firstParam", StringValue = "myValue"
                            }
                        }
                    }
                }
            };

            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Does.Contain("<parameter name=\"firstParam\">myValue</parameter>"));
        }
Exemple #2
0
 public TestXml() : base()
 {
     Constraints = new List <AbstractConstraintXml>();
     Systems     = new List <AbstractSystemUnderTestXml>();
     Condition   = new ConditionXml();
     GroupNames  = new List <string>();
 }
Exemple #3
0
 public TestXml() : base()
 {
     InstanceSettling = InstanceSettlingXml.Unique;
     Constraints      = new List <AbstractConstraintXml>();
     Systems          = new List <AbstractSystemUnderTestXml>();
     Condition        = new ConditionXml();
     GroupNames       = new List <string>();
 }
Exemple #4
0
 public TestXml()
     : base()
 {
     Constraints = new List<AbstractConstraintXml>();
     Systems = new List<AbstractSystemUnderTestXml>();
     Condition = new ConditionXml();
     GroupNames = new List<string>();
 }
Exemple #5
0
 public TestXml()
 {
     Constraints = new List<AbstractConstraintXml>();
     Systems = new List<AbstractSystemUnderTestXml>();
     Categories = new List<string>();
     Setup = new SetupXml();
     Cleanup = new CleanupXml();
     Condition = new ConditionXml();
     GroupNames = new List<string>();
 }
Exemple #6
0
 public TestXml()
 {
     Constraints = new List <AbstractConstraintXml>();
     Systems     = new List <AbstractSystemUnderTestXml>();
     Categories  = new List <string>();
     Setup       = new SetupXml();
     Cleanup     = new CleanupXml();
     Condition   = new ConditionXml();
     GroupNames  = new List <string>();
 }
Exemple #7
0
 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);
         }
     }
 }
Exemple #8
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}");
         }
     }
 }
Exemple #9
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}");
         }
     }
 }
Exemple #10
0
 public TestXml(TestStandaloneXml standalone)
 {
     Categories         = standalone.Categories;
     Cleanup            = standalone.Cleanup;
     Condition          = standalone.Condition;
     Constraints        = standalone.Constraints;
     DescriptionElement = standalone.DescriptionElement;
     Drafts             = standalone.Drafts;
     Edition            = standalone.Edition;
     IgnoreElement      = standalone.IgnoreElement;
     InstanceSettling   = standalone.InstanceSettling;
     Name             = standalone.Name;
     Setup            = standalone.Setup;
     Systems          = standalone.Systems;
     Traits           = standalone.Traits;
     UniqueIdentifier = standalone.UniqueIdentifier;
 }
Exemple #11
0
        public void Serialize_Custom_Correct()
        {
            var root = new ConditionXml()
            {
                Predicates = new List <DecorationConditionXml>()
                {
                    new CustomConditionXml()
                    {
                        AssemblyPath = "myAssembly.dll",
                        TypeName     = "myType",
                    }
                }
            };

            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Does.Contain("<custom "));
            Assert.That(xml, Does.Contain("assembly-path=\"myAssembly.dll\""));
            Assert.That(xml, Does.Contain("type=\"myType\""));
            Assert.That(xml, Does.Not.Contain("<parameter"));
        }
Exemple #12
0
        public void Serialize_FileExists_Correct()
        {
            var root = new ConditionXml()
            {
                Predicates = new List <DecorationConditionXml>()
                {
                    new FileExistsConditionXml()
                    {
                        Path     = "Folder\\",
                        Name     = "myFileName.txt",
                        NotEmpty = true
                    }
                }
            };

            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Does.Contain("<file-exists "));
            Assert.That(xml, Does.Contain("path=\"Folder\\\""));
            Assert.That(xml, Does.Contain("name=\"myFileName.txt\""));
            Assert.That(xml, Does.Contain("not-empty=\"true\""));
        }
Exemple #13
0
        public void Serialize_FolderExists_Correct()
        {
            var root = new ConditionXml()
            {
                Predicates = new List <DecorationConditionXml>()
                {
                    new FolderExistsConditionXml()
                    {
                        Path     = ".",
                        Name     = "myFolderName",
                        NotEmpty = false
                    }
                }
            };

            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Does.Contain("<folder-exists "));
            Assert.That(xml, Does.Contain("path=\".\""));
            Assert.That(xml, Does.Contain("name=\"myFolderName\""));
            Assert.That(xml, Does.Not.Contain("not-empty"));
        }
Exemple #14
0
 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);
     }
 }