예제 #1
0
 private bool PropertiesAreCorrelatedButValueIndexesDontMatch(DymeCase case1, DymeCase case2)
 {
     /// An implicit rule of correlation in this system is that for any given permutation of
     /// property-values the value-indexes of correlated properties must match...
     /// In other words, in the set of all permutations,
     /// the permutations where two correlated item's value indexes don't match,
     /// should not exist, and can therefore be removed from the set of all permutations.
     foreach (var case1Property in case1.Properties)
     {
         foreach (var case2Property in case2.Properties)
         {
             if (case1Property.CorrelationKey != null &&
                 case1Property.CorrelationKey == case2Property.CorrelationKey &&
                 case1Property.ValueIndexFromOriginalList != case2Property.ValueIndexFromOriginalList)
             {
                 return(true);
             }
             if (CorrelationPathsMatchButIndexesDontMatch(case1Property, case2Property))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #2
0
        private DymeCase OverlayCases(DymeCase baseCase, DymeCase overlayCase)
        {
            var newPropertySet = new List <DymeCaseProperty>();

            newPropertySet.AddRange(overlayCase.Properties.ToList());
            newPropertySet.AddRange(baseCase.Properties.Where(bc => !overlayCase.Properties.Any(op => op.Name == bc.Name)));
            return(new DymeCase()
            {
                Properties = newPropertySet
            });
        }
예제 #3
0
        public void Property_GivenPropertyName_ExpectPropertyValue()
        {
            // Arrange...
            var sut = new DymeCase();

            sut.Properties = new List <DymeCaseProperty>()
            {
                new DymeCaseProperty("Name", "Bob")
            };
            // Act...
            var result = sut.Property("Name");

            // Assert...
            Assert.AreEqual("Bob", result);
        }
예제 #4
0
        /// <summary>
        /// This method gets called at the leaf-most parts of the node-tree.
        /// </summary>
        /// <param name="valueNode"></param>
        /// <param name="parent"></param>
        /// <param name="treePath"></param>
        /// <param name="configPath"></param>
        /// <returns></returns>
        private static IEnumerable <DymeCase> CaseFromValueNode(Node valueNode, Node parent, string treePath, string[] configPath, string correlationPath)
        {
            var propertyNamePart  = parent;
            var propertyValuePart = valueNode;

            var newProperty = new DymeCaseProperty(propertyNamePart.Value, propertyValuePart.Value, propertyNamePart.CorrelationKey);

            newProperty.PropertyIndex = propertyNamePart.ValueIndex;
            newProperty.ValueIndexFromOriginalList = propertyValuePart.ValueIndex;
            newProperty.OriginPath       = treePath;
            newProperty.OriginConfigPath = configPath;
            newProperty.CorrelationPath  = correlationPath;

            var newCase = new DymeCase();

            newCase.Properties = new[] { newProperty };
            return(new List <DymeCase>()
            {
                newCase
            });
        }
예제 #5
0
 private Dictionary <string, string> getDeviceFarmLoginFromTestCase(DymeCase testCase)
 {
     return(testCase.Properties
            .Where(p => p.Name.StartsWith("df."))
            .ToDictionary(i => i.Name, i => i.Name.Substring(3)));
 }
예제 #6
0
 private Dictionary <string, string> getDeviceDetailsFromTestCase(DymeCase testCase)
 {
     return(testCase.Properties
            .Where(p => p.Name.StartsWith("cap."))
            .ToDictionary(i => i.Name, i => i.Name.Substring(4)));
 }
예제 #7
0
 public string CaseToGrid(DymeCase caseX, string propertySeparator = "\t")
 {
     return(caseX.Properties.OrderBy(i => i.Name).Select(s => s.Value).Aggregate((a, b) => $"{a}{propertySeparator}{b}"));
 }
예제 #8
0
 public string CaseToString(DymeCase caseX, string propertySeparator = " ")
 {
     return(caseX.Properties.OrderBy(i => i.Name).Select(s => $"p:{s.Name}({s.Value})").Aggregate((a, b) => $"{a}{propertySeparator}{b}"));
 }
 private string CaseToString(DymeCase caseX, string separator = ",")
 {
     return(caseX.Properties.OrderBy(i => i.Name).Select(s => s.Value).Aggregate((a, b) => $"{a}{separator}{b}"));
 }