コード例 #1
0
        public void ArrangeWhenMeasureChangedTest()
        {
            TestTaskScheduler scheduler = (TestTaskScheduler)ApplicationHost.Current.TaskScheduler;

            using (scheduler.DisableImmediateProcessing())
            {
                TestElement element = new TestElement
                {
                    MeasureSize = new Size(100, 100),
                    ArrangeSize = new Size(100, 100),
                };

                element.IsRootElement = true;

                element.Measure(new Size(100, 100));
                element.Arrange(new Rect(0, 0, 100, 100));
                Assert.AreEqual(1, element.MeasureCount);
                Assert.AreEqual(1, element.ArrangeCount);

                element.InvalidateMeasure();
                scheduler.ProcessDueOperations();
                Assert.AreEqual(2, element.MeasureCount);
                Assert.AreEqual(1, element.ArrangeCount);

                element.MeasureSize = new Size(150, 150);
                element.InvalidateMeasure();
                scheduler.ProcessDueOperations();
                Assert.AreEqual(3, element.MeasureCount);
                Assert.AreEqual(2, element.ArrangeCount);
            }
        }
コード例 #2
0
        public void MeasureVisibleOnlyTest()
        {
            TestTaskScheduler scheduler = (TestTaskScheduler)ApplicationHost.Current.TaskScheduler;

            using (scheduler.DisableImmediateProcessing())
            {
                TestElement child = new TestElement();

                TestContainer parent = new TestContainer();
                parent.Child = child;

                parent.InvalidateMeasure();
                parent.InvalidateArrange();
                child.InvalidateMeasure();
                child.InvalidateArrange();

                scheduler.ProcessDueOperations();

                Assert.AreEqual(0, parent.MeasureCount);
                Assert.AreEqual(0, parent.ArrangeCount);
                Assert.AreEqual(0, child.MeasureCount);
                Assert.AreEqual(0, child.ArrangeCount);

                Assert.IsFalse(parent.IsMeasureValid);
                Assert.IsFalse(parent.IsArrangeValid);
                Assert.IsFalse(child.IsMeasureValid);
                Assert.IsFalse(child.IsArrangeValid);
            }
        }
コード例 #3
0
ファイル: cli_cs_bridgetest.cs プロジェクト: sitedata/core-1
        static bool equals(TestElement rData1, TestElement rData2)
        {
            check(rData1.Bool == rData2.Bool, "### bool does not match!");
            check(rData1.Char == rData2.Char, "### char does not match!");
            check(rData1.Byte == rData2.Byte, "### byte does not match!");
            check(rData1.Short == rData2.Short, "### short does not match!");
            check(rData1.UShort == rData2.UShort, "### unsigned short does not match!");
            check(rData1.Long == rData2.Long, "### long does not match!");
            check(rData1.ULong == rData2.ULong, "### unsigned long does not match!");
            check(rData1.Hyper == rData2.Hyper, "### hyper does not match!");
            check(rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!");
            check(rData1.Float == rData2.Float, "### float does not match!");
            check(rData1.Double == rData2.Double, "### double does not match!");
            check(rData1.Enum == rData2.Enum, "### enum does not match!");
            check(rData1.String == rData2.String, "### string does not match!");
            check(rData1.Interface == rData2.Interface, "### interface does not match!");
            check(compareData(rData1.Any, rData2.Any), "### any does not match!");

            return(rData1.Bool == rData2.Bool &&
                   rData1.Char == rData2.Char &&
                   rData1.Byte == rData2.Byte &&
                   rData1.Short == rData2.Short &&
                   rData1.UShort == rData2.UShort &&
                   rData1.Long == rData2.Long &&
                   rData1.ULong == rData2.ULong &&
                   rData1.Hyper == rData2.Hyper &&
                   rData1.UHyper == rData2.UHyper &&
                   rData1.Float == rData2.Float &&
                   rData1.Double == rData2.Double &&
                   rData1.Enum == rData2.Enum &&
                   rData1.String == rData2.String &&
                   rData1.Interface == rData2.Interface &&
                   compareData(rData1.Any, rData2.Any));
        }
コード例 #4
0
        public void MeasureParentOnceTest()
        {
            TestTaskScheduler scheduler = (TestTaskScheduler)ApplicationHost.Current.TaskScheduler;

            using (scheduler.DisableImmediateProcessing())
            {
                TestContainer parent = new TestContainer();

                TestElement child = new TestElement
                {
                    MeasureSize = new Size(100, 100),
                    ArrangeSize = new Size(100, 100),
                };

                parent.IsRootElement = true;
                parent.Child         = child;

                parent.Measure(new Size(100, 100));
                parent.Arrange(new Rect(0, 0, 200, 200));

                scheduler.ProcessDueOperations();

                Assert.AreEqual(1, parent.MeasureCount);
                Assert.AreEqual(1, parent.ArrangeCount);
                Assert.AreEqual(1, child.MeasureCount);
                Assert.AreEqual(1, child.ArrangeCount);

                Assert.IsTrue(parent.IsMeasureValid);
                Assert.IsTrue(parent.IsArrangeValid);
                Assert.IsTrue(child.IsMeasureValid);
                Assert.IsTrue(child.IsArrangeValid);
            }
        }
コード例 #5
0
ファイル: cli_cs_bridgetest.cs プロジェクト: sitedata/core-1
 static void assign(TestElement rData,
                    bool bBool, char cChar, byte nByte,
                    short nShort, ushort nUShort,
                    int nLong, uint nULong,
                    long nHyper, ulong nUHyper,
                    float fFloat, double fDouble,
                    TestEnum eEnum, string rStr,
                    Object xTest,
                    Any rAny)
 {
     rData.Bool      = bBool;
     rData.Char      = cChar;
     rData.Byte      = nByte;
     rData.Short     = nShort;
     rData.UShort    = nUShort;
     rData.Long      = nLong;
     rData.ULong     = nULong;
     rData.Hyper     = nHyper;
     rData.UHyper    = nUHyper;
     rData.Float     = fFloat;
     rData.Double    = fDouble;
     rData.Enum      = eEnum;
     rData.String    = rStr;
     rData.Interface = xTest;
     rData.Any       = rAny;
 }
コード例 #6
0
        public void visitTest(TestElement element, TestPosition position)
        {
            if (element.Action == null)
            {
                var testContext = new TestContext()
                {
                    Name           = _fixtureContext.NameReservations.GetReservedTestName(element.Description, _parent.Name),
                    Position       = position,
                    FixtureContext = _fixtureContext
                };

                var test = _fixtureContext.NativeTestFactory.ForTest(_fixtureContext, testContext);
                test.MarkTestInvalid("Specification is not implemented.");

                ApplyCategoryAndIgnoreIfSet(test);

                _accumulatedDescendants.Add(test);
            }
            else
            {
                var buildResult = _fixtureContext.CreateTest(_parent, position, element.Description);

                ApplyCategoryAndIgnoreIfSet(buildResult);

                _accumulatedDescendants.Add(buildResult);
            }
        }
コード例 #7
0
        static void Main(string[] args)
        {
            System.IO.FileStream xmlFile       = new System.IO.FileStream("../../../XMLTestRequests/TestRequest", System.IO.FileMode.Open);
            XDocument            testRquestDoc = new XDocument();

            testRquestDoc = XDocument.Load(xmlFile);
            Loader      objLoader = new Loader();
            TestElement te1       = new TestElement("FirstTest");

            te1.addDriver("TestDriver.dll");
            te1.addCode("CodeToTest1.dll");
            te1.addCode("CodeToTest2.dll");
            TestElement te2 = new TestElement("test2");

            te2.addDriver("TestDriver2.dll");
            te2.addCode("CodeToTest1.dll");
            te2.addCode("CodeToTest3.dll");
            TestRequest tr = new TestRequest();

            tr.author = "Rahul The Great";
            tr.tests.Add(te1);
            tr.tests.Add(te2);

            Logger objLoggerTH = new Logger("../../../ Logs / TestHarnessLogs / TestHarnessLog_" + DateTime.Now.ToString().Replace(" / ", " - ").Replace(":", " - ") + ".txt");

            objLoader.test(tr, objLoggerTH, "Karthik");
        }
コード例 #8
0
ファイル: TWeaverPathPipe.cs プロジェクト: inthefabric/Weaver
        public void HasNotProp()
        {
            TestElement result = vElem.HasNot(x => x.Value);

            Assert.AreEqual(vElem, result, "Incorrect result.");
            vElem.MockPath.Verify(x => x.AddItem(It.IsAny <WeaverStepHas <TestElement> >()), Times.Once());
        }
コード例 #9
0
    public SortingTests()
    {
        //allocate memory
        smallTestIntegerArray = new int[1000];
        bigTestIntegerArray   = new int[100000];
        smallTestObjectArray  = new TestElement[1000];
        bigTestObjectArray    = new TestElement[100000];

        //Generate data
        FillWithRandomIntegers(smallTestIntegerArray);
        FillWithRandomIntegers(bigTestIntegerArray);
        for (int i = 0; i < smallTestObjectArray.Length; i++)
        {
            TestElement e = new TestElement();
            e.a = rand.Next();
            e.b = rand.Next();
            smallTestObjectArray[i] = e;
        }
        for (int i = 0; i < bigTestObjectArray.Length; i++)
        {
            TestElement e = new TestElement();
            e.a = rand.Next();
            e.b = rand.Next();
            bigTestObjectArray[i] = e;
        }
    }
コード例 #10
0
        public void CacheQuadrupleGetWithIntermediateActualityDrop()
        {
            var dictionary = new TestElementCache(queueRebalance: a => Task.Factory.StartNew(a));
            var test       = new TestElementCache.TestMock(dictionary);

            var key = Guid.NewGuid();
            var val = new TestElement {
                Updated = 1, Value = key
            };
            var newVal = new TestElement {
                Updated = 2, Value = key
            };
            var newVal2 = new TestElement {
                Updated = 3, Value = key
            };

            dictionary.Push(key, val);
            dictionary.Push(key, val);
            dictionary.SetUpdateNecessity(key);
            dictionary.Push(key, newVal);
            val = dictionary.RetrieveByFunc(key, k => newVal2);
            UpdatableElement <TestElement> fl;
            var res = test.FirstLevel.TryGetValue(key, out fl);

            Assert.IsFalse(res);
            Assert.AreEqual(1, test.SecondLevel.Count);
            Assert.IsFalse(test.SecondLevel[key].NeedUpdate());
            Assert.AreEqual(2, val.Updated);
        }
コード例 #11
0
        static void assign( TestElement rData,
					bool bBool, char cChar, byte nByte,
					short nShort, ushort nUShort,
					int nLong, uint nULong,
					long nHyper, ulong nUHyper,
					float fFloat, double fDouble,
					TestEnum eEnum, string rStr,
					Object xTest,
					Any rAny )
        {
            rData.Bool = bBool;
            rData.Char = cChar;
            rData.Byte = nByte;
            rData.Short = nShort;
            rData.UShort = nUShort;
            rData.Long = nLong;
            rData.ULong = nULong;
            rData.Hyper = nHyper;
            rData.UHyper = nUHyper;
            rData.Float = fFloat;
            rData.Double = fDouble;
            rData.Enum = eEnum;
            rData.String = rStr;
            rData.Interface = xTest;
            rData.Any = rAny;
        }
コード例 #12
0
ファイル: ParserTest.cs プロジェクト: thescruba/sharpkml
        public void TestAttributes()
        {
            const string Xml = @"
<TestElement Attribute=""string"" EnumAtt=""random"">
  <WebAddress>
    http://www.example.com
  </WebAddress>
  <Int>1</Int>
  <OptionalInt>
    2
  </OptionalInt>
  <Enum>random</Enum>
</TestElement>";

            Parser parser = new Parser();

            parser.ParseString(Xml, true);

            TestElement element = parser.Root as TestElement;

            Assert.That(element, Is.Not.Null);

            Assert.That(element.Attribute, Is.EqualTo("string"));
            Assert.That(element.Enum, Is.EqualTo(ColorMode.Random));
            Assert.That(element.EnumAtt, Is.EqualTo(ColorMode.Random));
            Assert.That(element.Int, Is.EqualTo(1));
            Assert.That(element.OptionalInt, Is.EqualTo(2));
            Assert.That(element.Uri, Is.EqualTo(new Uri("http://www.example.com")));
        }
コード例 #13
0
        public void FlowElement_GetTypedKey()
        {
            var element  = new TestElement();
            var typedKey = element.ElementDataKeyTyped;

            Assert.AreEqual(element.ElementDataKey, typedKey.Name);
        }
コード例 #14
0
            public static bool Test1()
            {
                System.Random ran = new System.Random(2134);
//%%if IsEx==0 (
                BList <int>     list1 = new BList <int>();
                Gen::List <int> list2 = new System.Collections.Generic.List <int>();
//%%elif IsEx==1
                BListEx <TestElement>   list1 = new BListEx <TestElement>();
                Gen::List <TestElement> list2 = new System.Collections.Generic.List <TestElement>();
//%%)
                const int N = 10000;

                for (int i = 0; i < N; i++)
                {
//%%if IsEx==0 (
                    int n = (int)(ran.NextDouble() * 10000);
//%%elif IsEx==1
                    TestElement n = new TestElement((int)(ran.NextDouble() * 10000));
//%%)
                    list1.Add(n);
                    list2.Add(n);
                }

                for (int i = 0; i < N; i++)
                {
                    if (list1[i] != list2[i])
                    {
                        return(false);
                    }
                }
                return(true);
            }
        //-------------------------------------<Function to generate a test Request>--------------------------------------
        public TestRequest generateTestRequest()

        {
            TestElement te1 = new TestElement();
            TestName    t1  = new TestName();

            t1.testName  = "TestDriver.dll";
            te1.testName = "Test1";
            te1.addDriver(t1);
            TestName t2 = new TestName();
            TestName t3 = new TestName();

            t2.testName = "TestedOne.dll";
            t3.testName = "TestedTwo.dll";
            te1.addCode(t2);
            te1.addCode(t3);


            TestRequest tr = new TestRequest();

            tr.author = "Sarath Patlolla";
            tr.tests.Add(te1);

            xml = tr.ToXml();
            Console.Write("\n  Serialized TestRequest data structure:\n\n  {0}\n", xml);



            //Console.Write("\n  deserializing xml string results in type: {0}\n", typeName);
            return(tr);
        }
コード例 #16
0
        public void TestAttributes()
        {
            // Try the attributes first
            TestElement element = new TestElement();

            element.Attribute = "attribute";
            element.EnumAtt   = ColorMode.Random;

            Serializer serializer = new Serializer();

            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "TestElementS", r =>
            {
                Assert.That(r.GetAttribute("Attribute"), Is.EqualTo("attribute"));
                Assert.That(r.GetAttribute("EnumAtt"), Is.EqualTo("random"));
            }));


            // Try optional elements = make sure they're only serialized if they have a value
            element.Int = 42;
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "Int", r =>
                                 Assert.That(r.ReadElementContentAsInt(), Is.EqualTo(42))));

            Assert.False(FindNode(serializer.Xml, "OptionalInt", null));

            element.OptionalInt = 0;
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "OptionalInt", r =>
                                 Assert.That(r.ReadElementContentAsInt(), Is.EqualTo(0))));
        }
コード例 #17
0
ファイル: DAL_IMP.cs プロジェクト: acerosen/Final
        public void DeleteTest(int TestID)
        {
            try
            {
                IEnumerable <XElement> TestElements;
                XElement TestElement;
                TestElement = (from p in TestRoot.Elements()
                               where p.Element("TestID").Value == TestID.ToString()
                               select p).FirstOrDefault();

                TestElements = from p in TestRoot.Elements()
                               where Convert.ToInt32(p.Element("TestID").Value) == TestID // very nice
                               select p;
                foreach (var item in TestElements)
                {
                    item.Remove();
                }
                TestRoot.Save(TestPath);
                TestElement.Remove();
                TestRoot.Save(TestPath);
            }
            catch
            // By the way, i got accepted to go to the Kenes Technologia in Jerusalem.
            // My father is giving a speech there for like a million people
            // Maybe
            // Apply to go with your Father
            //https://summit.ourcrowd.com/registration/
            {
                throw new Exception("The order dos'nt exsist in the system");
            }
        }
コード例 #18
0
 public void embedded_empty_lines_are_removed_when_trim_is_true()
 {
     var lines = new[] { " \n   \n \r\n hello \n world ", " \r\n  another line  " };
     var expected = new[] { "hello", "world", "another line" };
     var t = new TestElement(lines);
     Assert.AreEqual(String.Join("\r\n", expected), t.GetTextLines(trim: true));
 }
コード例 #19
0
        public void ReverseReplace(TestElement el, Boolean regexMatch)
        {
            List <NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction,
                                                                                                                    variables, regexMatch));

            SetProperties(el, newProps);
        }
コード例 #20
0
        public static void TestTreeToListWorks()
        {
            // Arrange
            TestElement root = new TestElement("root", -1);

            root.children = new List <TreeElement>();
            root.children.Add(new TestElement("A", 0));
            root.children.Add(new TestElement("B", 0));
            root.children.Add(new TestElement("C", 0));

            root.children[1].children = new List <TreeElement>();
            root.children[1].children.Add(new TestElement("Bchild", 1));

            root.children[1].children[0].children = new List <TreeElement>();
            root.children[1].children[0].children.Add(new TestElement("Bchildchild", 2));

            // Test
            List <TestElement> result = new List <TestElement>();

            TreeElementUtility.TreeToList(root, result);

            // Assert
            string[] namesInCorrectOrder = { "root", "A", "B", "Bchild", "Bchildchild", "C" };
            Assert.AreEqual(namesInCorrectOrder.Length, result.Count, "Result count is not match");
            for (int i = 0; i < namesInCorrectOrder.Length; ++i)
            {
                Assert.AreEqual(namesInCorrectOrder[i], result[i].name);
            }
            TreeElementUtility.ValidateDepthValues(result);
        }
コード例 #21
0
ファイル: SerializerTest.cs プロジェクト: karun10/KML2SQL
        public void TestAttributes()
        {
            // Try the attributes first
            TestElement element = new TestElement();
            element.Attribute = "attribute";
            element.EnumAtt = ColorMode.Random;

            Serializer serializer = new Serializer();
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "TestElementS", r =>
                {
                    Assert.That(r.GetAttribute("Attribute"), Is.EqualTo("attribute"));
                    Assert.That(r.GetAttribute("EnumAtt"), Is.EqualTo("random"));
                }));

            // Try optional elements = make sure they're only serialized if they have a value
            element.Int = 42;
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "Int", r =>
                Assert.That(r.ReadElementContentAsInt(), Is.EqualTo(42))));

            Assert.False(FindNode(serializer.Xml, "OptionalInt", null));

            element.OptionalInt = 0;
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "OptionalInt", r =>
                Assert.That(r.ReadElementContentAsInt(), Is.EqualTo(0))));
        }
コード例 #22
0
        public void ReplaceValues(TestElement el)
        {
            List <NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new ReplaceStringWithFunctions(masterFunction,
                                                                                                                   variables));

            SetProperties(el, newProps);
        }
コード例 #23
0
 public void lines_are_trimmed_when_trim_is_true()
 {
     var lines = new[] { "  hello ", "   world  " };
     var expected = new[] { "hello", "world" };
     var t = new TestElement(lines);
     Assert.AreEqual(String.Join("\r\n", expected), t.GetTextLines(trim: true));
 }
コード例 #24
0
 public void lines_are_not_flattened_when_flatten_is_false()
 {
     var lines = new[] { "  hello ", "   world  " };
     var expected = new[] { "  hello ", "   world  " };
     var t = new TestElement(lines);
     Assert.AreEqual(String.Join("\r\n", expected), t.GetTextLines(flatten: false));
 }
コード例 #25
0
 public void lines_containing_embedded_line_breaks_are_trimmed_when_trim_is_true()
 {
     var lines = new[] { "  hello \n world ", "   another line  " };
     var expected = new[] { "hello", "world", "another line" };
     var t = new TestElement(lines);
     Assert.AreEqual(String.Join("\r\n", expected), t.GetTextLines(trim: true));
 }
コード例 #26
0
 public SerializableTestElement(TestElement testElement)
 {
     Name         = testElement.Name;
     Border       = testElement.Border;
     GridPosition = testElement.GridPosition;
     GridSize     = testElement.GridSize;
 }
コード例 #27
0
        public void undoReverseReplace(TestElement el)
        {
            List <NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new UndoVariableReplacement(masterFunction,
                                                                                                                variables));

            SetProperties(el, newProps);
        }
コード例 #28
0
 public void DeleteTest(int TestID)
 {
     try
     {
         IEnumerable <XElement> TestElements;
         XElement TestElement;
         TestElement = (from p in TestRoot.Elements()
                        where p.Element("TestID").Value == T.ID.ToString()
                        select p).FirstOrDefault();
         TestElements = from p in TestRoot.Elements()
                        where Convert.ToInt32(p.Element("TestID").Value) == T.ID
                        select p;
         foreach (var item in TestElements)
         {
             item.Remove();
         }
         TestRoot.Save(TestPath);
         TestElement.Remove();
         TestRoot.Save(TestPath);
     }
     catch
     {
         throw new Exception("The order dos'nt exsist in the system");
     }
 }
コード例 #29
0
            static bool Test2b()
            {
                System.Random ran = new System.Random(2134);

                {
//%%if IsEx==0 (
                    Gen::List <int> list2 = new System.Collections.Generic.List <int>();
//%%elif IsEx==1
                    Gen::List <TestElement> list2 = new System.Collections.Generic.List <TestElement>();
//%%)
                    const int N = 100000;
                    for (int i = 0; i < N; i++)
                    {
                        int idx = (int)(ran.NextDouble() * list2.Count);
//%%if IsEx==0 (
                        list2.Insert(idx, i);
//%%elif IsEx==1
                        TestElement e = new TestElement(i);
                        list2.Insert(idx, e);
//%%)
                    }

                    for (int i = 0; i < N / 2; i++)
                    {
                        int idx = (int)(ran.NextDouble() * list2.Count);
                        list2.RemoveAt(idx);
                    }
                }
                return(true);
            }
コード例 #30
0
        private void Ending()
        {
            if (tasks.qestions != "0")
            {
                XDocument xdocum = XDocument.Load("XMLBAS.xml");
                foreach (XElement TestElement in xdocum.Root.Elements())
                {
                    if (TestElement.Attribute("Name").Value == tasks.name && TestElement.Attribute("Author").Value == tasks.author)
                    {
                        TestElement.Remove();
                    }
                }
                xdocum.Save("XMLBAS.xml");

                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(@"XMLBAS.xml");
                XmlElement testElement = xdoc.CreateElement("test");
                testElement.SetAttribute("Name", tasks.name);
                testElement.SetAttribute("Author", tasks.author);
                testElement.SetAttribute("Qestions", qestionsAll);
                testElement.SetAttribute("pas", tasks.password);
                foreach (string a in tasks.qestion)
                {
                    XmlElement qestionElememnt = xdoc.CreateElement("question");
                    qestionElememnt.SetAttribute("qes", a);
                    qestionElememnt.SetAttribute("ans", tasks.answers[tasks.qestion.IndexOf(a)]);
                    qestionElememnt.SetAttribute("pic", tasks.pictures[tasks.qestion.IndexOf(a)]);
                    qestionElememnt.SetAttribute("v1", tasks.V1[tasks.qestion.IndexOf(a)]);
                    qestionElememnt.SetAttribute("v2", tasks.V2[tasks.qestion.IndexOf(a)]);
                    qestionElememnt.SetAttribute("v3", tasks.V3[tasks.qestion.IndexOf(a)]);
                    qestionElememnt.SetAttribute("v4", tasks.V4[tasks.qestion.IndexOf(a)]);
                    testElement.AppendChild(qestionElememnt);
                }
                XmlElement el = xdoc.DocumentElement;
                el.AppendChild(testElement);
                xdoc.Save("XMLBAS.xml");

                Window1 w = new Window1();
                w.Show();

                this.Close();
            }
            else
            {
                XDocument xdocum = XDocument.Load("XMLBAS.xml");
                foreach (XElement TestElement in xdocum.Root.Elements())
                {
                    if (TestElement.Attribute("Name").Value == tasks.name && TestElement.Attribute("Author").Value == tasks.author)
                    {
                        TestElement.Remove();
                    }
                }
                xdocum.Save("XMLBAS.xml");
                Window1 w = new Window1();
                w.Show();

                this.Close();
            }
        }
コード例 #31
0
ファイル: TestPlan.cs プロジェクト: CDHDeveloper/NetMeter
 public void AddTestElement(TestElement tg)
 {
     base.AddTestElement(tg);
     if (tg is AbstractThreadGroup && !isRunningVersion())
     {
         AddThreadGroup((AbstractThreadGroup)tg);
     }
 }
コード例 #32
0
 private void SetProperties(TestElement el, List <NetMeterProperty> newProps)
 {
     el.Clear();
     foreach (NetMeterProperty jmp in newProps)
     {
         el.SetProperty(jmp);
     }
 }
コード例 #33
0
        public ActionResult DeleteConfirmed(int id)
        {
            TestElement testElement = db.TestElements.Find(id);

            db.TestElements.Remove(testElement);
            db.SaveChanges();
            return(RedirectToAction("GetTestElementList", "TestElements"));
        }
コード例 #34
0
ファイル: TestPlan.cs プロジェクト: RalphC/NetMeter
 public void AddTestElement(TestElement tg)
 {
     base.AddTestElement(tg);
     if (tg is AbstractThreadGroup && !isRunningVersion())
     {
         AddThreadGroup((AbstractThreadGroup) tg);
     }
 }
コード例 #35
0
ファイル: TWeaverPathPipe.cs プロジェクト: inthefabric/Weaver
        /*--------------------------------------------------------------------------------------------*/
        private static void VerifyCustom(TestElement pElem, string pScript, bool pSkipDot = false)
        {
            Assert.AreEqual(1, pElem.PathItems.Count, "Incorrect PathItems.Count.");
            WeaverStepCustom cust = VerifyFirstPathItem <WeaverStepCustom>(pElem);

            Assert.AreEqual(pScript, cust.BuildParameterizedString(), "Incorrect Script.");
            Assert.AreEqual(pSkipDot, cust.SkipDotPrefix, "Incorrect SkipDotPrefix.");
        }
コード例 #36
0
        public void TransformReturnsTheElement()
        {
            TestElement element = InternalTestNodes.TestElement("fred");

            GivenATransformerWithActions(element);
            WhenTransformIsCalledForElement(element);
            ThenTheResultIs(element);
        }
コード例 #37
0
        public void TransformCallsEachAction()
        {
            TestElement element = InternalTestNodes.TestElement("fred");

            GivenATransformerWithActions(element, MockRepository.GenerateStub <IElementTransformerAction>(), MockRepository.GenerateStub <IElementTransformerAction>());
            WhenTransformIsCalledForElement(element);
            EachActionIsExecutedWithElement(element);
        }
コード例 #38
0
 public void lines_are_flattened_when_flatten_is_true()
 {
     var lines = new[] { "  hello ", "   world  " };
     var expected = new[] { "  hello ", "   world  " };
     var t = new TestElement(lines);
     const string join = "!!#!#!!";
     Assert.AreEqual(String.Join(join, expected), t.GetTextLines(flatten: true, join: join));
 }
コード例 #39
0
 public void lines_containing_embedded_line_breaks_are_not_trimmed_when_trim_is_false()
 {
     var lines = new[] { "  hello\nworld ", "   world  " };
     var expected = new[] { "  hello", "world ", "   world  " };
     var t = new TestElement(lines);
     const string join = "!!#!#!!";
     Assert.AreEqual(String.Join(join, expected), t.GetTextLines(flatten: true, join: join));
 }
コード例 #40
0
        public void Constructor_SimulationContextExists_ResourceRegistered()
        {
            using(var context = new SimulationContext(isDefaultContextForProcess: true)){
                var element = new TestElement();

                var registeredElements = context.GetByType<TestElement>();
                Assert.IsTrue(registeredElements.Contains(element));
            }
        }
コード例 #41
0
 public void SimpleCacheTest()
 {
     var key = Guid.NewGuid();
     var element = new TestElement {Frequency = 1, Value = 1};
     var cache = CreateCache();
     cache.Add(key,element);
     var foundElement = cache.Find(key);
     Assert.AreEqual(element.Value,foundElement.Value);
     Assert.IsFalse(_wasRebalancing);
 }
コード例 #42
0
ファイル: SerializerTest.cs プロジェクト: karun10/KML2SQL
        public void TestChild()
        {
            TestElement element = new TestElement();
            element.Child = new ChildElement();
            element.Child.Counter = 1;

            Serializer serializer = new Serializer();
            serializer.Serialize(element);
            Assert.True(FindNode(serializer.Xml, "counter", r =>
                Assert.That(r.ReadElementContentAsInt(), Is.EqualTo(1))));
        }
コード例 #43
0
 public void CacheTestWithNoRebalancing()
 {
     var key = Guid.NewGuid();
     var element = new TestElement { Frequency = 1, Value = 1 };
     var cache = CreateCache();
      cache.Add(key, element);
     for (var i = 0; i < cache.State.AdaptationSettings.CheckThreshold + 1;i++)
         cache.Find(key);
     var foundElement = cache.Find(key);
     Assert.AreEqual(element.Value, foundElement.Value);
     Assert.IsFalse(_wasRebalancing);//не будет ребалансировки, потому что ожидаемый путь (1 изначально) совпадает с фактическим
 }
コード例 #44
0
        static bool equals(TestElement rData1, TestElement  rData2)
        {
            check( rData1.Bool == rData2.Bool, "### bool does not match!" );
            check( rData1.Char == rData2.Char, "### char does not match!" );
            check( rData1.Byte == rData2.Byte, "### byte does not match!" );
            check( rData1.Short == rData2.Short, "### short does not match!" );
            check( rData1.UShort == rData2.UShort, "### unsigned short does not match!" );
            check( rData1.Long == rData2.Long, "### long does not match!" );
            check( rData1.ULong == rData2.ULong, "### unsigned long does not match!" );
            check( rData1.Hyper == rData2.Hyper, "### hyper does not match!" );
            check( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" );
            check( rData1.Float == rData2.Float, "### float does not match!" );
            check( rData1.Double == rData2.Double, "### double does not match!" );
            check( rData1.Enum == rData2.Enum, "### enum does not match!" );
            check( rData1.String == rData2.String, "### string does not match!" );
            check( rData1.Interface == rData2.Interface, "### interface does not match!" );
            check( compareData(rData1.Any, rData2.Any), "### any does not match!" );

            return (rData1.Bool == rData2.Bool &&
                rData1.Char == rData2.Char &&
                rData1.Byte == rData2.Byte &&
                rData1.Short == rData2.Short &&
                rData1.UShort == rData2.UShort &&
                rData1.Long == rData2.Long &&
                rData1.ULong == rData2.ULong &&
                rData1.Hyper == rData2.Hyper &&
                rData1.UHyper == rData2.UHyper &&
                rData1.Float == rData2.Float &&
                rData1.Double == rData2.Double &&
                rData1.Enum == rData2.Enum &&
                rData1.String == rData2.String &&
                rData1.Interface == rData2.Interface &&
                compareData(rData1.Any, rData2.Any));
        }
コード例 #45
0
        /// <summary>
        /// Demonstrates how to store custom attributes and elements on a <see cref="File"/> element using a custom
        /// extension and element types.
        /// </summary>
        public static void StoreCustomExtension()
        {
            TestExtension extension;
            IExtensible extensible;
            Segment segment;
            XliffDocument document;
            XliffReader reader;
            Unit unit;
            string path;

            // This namespace will be stored on the document element like: <xliff xmlns:pre1="urn:custom:extension:1.0"
            const string customNamespace = "urn:custom:extension:1.0";
            const string customPrefix = "customPrefix";

            extension = new TestExtension();

            document = new XliffDocument("en-us");
            document.Files.Add(new File("f1"));

            unit = new Unit("u1");
            document.Files[0].Containers.Add(unit);

            segment = new Segment("s1");
            unit.Resources.Add(segment);

            segment.Source = new Source();
            segment.Source.Text.Add(new PlainText("text"));

            extensible = document.Files[0];

            // Create custom attributes that look like: <file id="f1" pre1:testattr1="testvalue1" pre1:testattr2="testvalue2">
            if (extensible.SupportsAttributeExtensions)
            {
                extension.AddAttribute(new TestAttribute(customPrefix, customNamespace, "testattr1", "testvalue1"));
                extension.AddAttribute(new TestAttribute(customPrefix, customNamespace, "testattr2", "testvalue2"));
                extensible.Extensions.Add(extension);
            }

            // Create a custom element that looks like: <pre1:testelement1 pre1:testattr1="testvalue1" />
            if (extensible.SupportsElementExtensions)
            {
                ElementInfo info;
                TestElement element;

                element = new TestElement();
                element.SetAttribute(customPrefix, customNamespace, "testattr1", "testvalue1");
                info = new ElementInfo(new XmlNameInfo(customPrefix, customNamespace, "testelement1"), element);
                extension.AddChild(info);
            }

            // Write the file just like any other file.
            path = IO.Path.GetTempFileName();
            SampleCode.WriteDocument(document, path);

            // Read the file using an custom extension handler so the custom types are loaded. The loaded File will
            // have the custom extension and attributes and elements on it just like it was created above.
            reader = new XliffReader();
            reader.RegisterExtensionHandler(customNamespace, new TestExtensionHandler());
            using (IO.FileStream stream = new IO.FileStream(path, IO.FileMode.Open, IO.FileAccess.Read))
            {
                document = reader.Deserialize(stream);
            }
        }
コード例 #46
0
ファイル: ValueReplacer.cs プロジェクト: RalphC/NetMeter
 public void ReverseReplace(TestElement el, Boolean regexMatch)
 {
     List<NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction,
             variables, regexMatch));
     SetProperties(el, newProps);
 }
コード例 #47
0
        static bool performSequenceTest(XBridgeTest xBT)
        {
            bool bRet = true;
            XBridgeTest2  xBT2 = xBT as XBridgeTest2;
            if ( xBT2 == null)
            return false;

            // perform sequence tests (XBridgeTest2)
            // create the sequence which are compared with the results
            bool[] arBool = {true, false, true};
            char[] arChar = {'A','B','C'};
            byte[] arByte = { 1,  2,  0xff};
            short[] arShort = {Int16.MinValue, 1,  Int16.MaxValue};
            UInt16[] arUShort = {UInt16.MinValue , 1, UInt16.MaxValue};
            int[] arLong = {Int32.MinValue, 1, Int32.MaxValue};
            UInt32[] arULong = {UInt32.MinValue, 1, UInt32.MaxValue};
            long[] arHyper = {Int64.MinValue, 1, Int64.MaxValue};
            UInt64[] arUHyper = {UInt64.MinValue, 1, UInt64.MaxValue};
            float[] arFloat = {1.1f, 2.2f, 3.3f};
            double[] arDouble = {1.11, 2.22, 3.33};
            string[] arString = {"String 1", "String 2", "String 3"};

            Any[] arAny = {new Any(true), new Any(11111), new Any(3.14)};
            Object[] arObject = {new WeakBase(), new WeakBase(), new WeakBase()};
            TestEnum[] arEnum = {TestEnum.ONE, TestEnum.TWO, TestEnum.CHECK};

            TestElement[] arStruct = {new TestElement(), new TestElement(),
                               new TestElement()};
            assign( arStruct[0], true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98,
             			0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359,
            TestEnum.LOLA, Constants.STRING_TEST_CONSTANT, arObject[0],
            new Any( typeof(Object),  arObject[0]) );
            assign( arStruct[1], true, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98,
            0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359,
            TestEnum.TWO, Constants.STRING_TEST_CONSTANT, arObject[1],
            new Any( typeof(Object), arObject[1]) );
            assign( arStruct[2], true, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98,
            0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359,
            TestEnum.CHECK, Constants.STRING_TEST_CONSTANT, arObject[2],
            new Any( typeof(Object), arObject[2] ) );

            int[][][] arLong3 = new int[][][]{
            new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} },
            new int [][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}},
            new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}};

            {
            int[][] seqSeqRet = xBT2.setDim2(arLong3[0]);
            bRet = check( compareData(seqSeqRet, arLong3[0]), "sequence test") && bRet;
            int[][][] seqSeqRet2 = xBT2.setDim3(arLong3);
            bRet = check( compareData(seqSeqRet2, arLong3), "sequence test") && bRet;
            Any[] seqAnyRet = xBT2.setSequenceAny(arAny);
            bRet = check( compareData(seqAnyRet, arAny), "sequence test") && bRet;
            bool[] seqBoolRet = xBT2.setSequenceBool(arBool);
            bRet = check( compareData(seqBoolRet, arBool), "sequence test") && bRet;
            byte[] seqByteRet = xBT2.setSequenceByte(arByte);
            bRet = check( compareData(seqByteRet, arByte), "sequence test") && bRet;
            char[] seqCharRet = xBT2.setSequenceChar(arChar);
            bRet = check( compareData(seqCharRet, arChar), "sequence test") && bRet;
            short[] seqShortRet = xBT2.setSequenceShort(arShort);
            bRet = check( compareData(seqShortRet, arShort), "sequence test") && bRet;
            int[] seqLongRet = xBT2.setSequenceLong(arLong);
            bRet = check( compareData(seqLongRet, arLong), "sequence test") && bRet;
            long[] seqHyperRet = xBT2.setSequenceHyper(arHyper);
            bRet = check( compareData(seqHyperRet,arHyper), "sequence test") && bRet;
            float[] seqFloatRet = xBT2.setSequenceFloat(arFloat);
            bRet = check( compareData(seqFloatRet, arFloat), "sequence test") && bRet;
            double[] seqDoubleRet = xBT2.setSequenceDouble(arDouble);
            bRet = check( compareData(seqDoubleRet, arDouble), "sequence test") && bRet;
            TestEnum[] seqEnumRet = xBT2.setSequenceEnum(arEnum);
            bRet = check( compareData(seqEnumRet, arEnum), "sequence test") && bRet;
            UInt16[] seqUShortRet = xBT2.setSequenceUShort(arUShort);
            bRet = check( compareData(seqUShortRet, arUShort), "sequence test") && bRet;
            UInt32[] seqULongRet = xBT2.setSequenceULong(arULong);
            bRet = check( compareData(seqULongRet, arULong), "sequence test") && bRet;
            UInt64[] seqUHyperRet = xBT2.setSequenceUHyper(arUHyper);
            bRet = check( compareData(seqUHyperRet, arUHyper), "sequence test") && bRet;
            Object[] seqObjectRet = xBT2.setSequenceXInterface(arObject);
            bRet = check( compareData(seqObjectRet, arObject), "sequence test") && bRet;
            string[] seqStringRet = xBT2.setSequenceString(arString);
            bRet = check( compareData(seqStringRet, arString), "sequence test") && bRet;
            TestElement[] seqStructRet = xBT2.setSequenceStruct(arStruct);
            bRet = check( compareData(seqStructRet, arStruct), "sequence test") && bRet;
            }
            {
            bool[] arBoolTemp = (bool[]) arBool.Clone();
            char[] arCharTemp = (char[]) arChar.Clone();
            byte[] arByteTemp = (byte[]) arByte.Clone();
            short[] arShortTemp = (short[]) arShort.Clone();
            UInt16[] arUShortTemp = (UInt16[]) arUShort.Clone();
            int[] arLongTemp = (int[]) arLong.Clone();
            UInt32[] arULongTemp = (UInt32[]) arULong.Clone();
            long[] arHyperTemp = (long[]) arHyper.Clone();
            UInt64[] arUHyperTemp = (UInt64[]) arUHyper.Clone();
            float[] arFloatTemp = (float[]) arFloat.Clone();
            double[] arDoubleTemp = (double[]) arDouble.Clone();
            TestEnum[] arEnumTemp = (TestEnum[]) arEnum.Clone();
            string[] arStringTemp = (string[]) arString.Clone();
            Object[] arObjectTemp = (Object[]) arObject.Clone();
            Any[] arAnyTemp = (Any[]) arAny.Clone();
            // make sure this are has the same contents as arLong3[0]
            int[][] arLong2Temp = new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} };
            // make sure this are has the same contents as arLong3
            int[][][] arLong3Temp = new int[][][]{
            new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} },
            new int [][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}},
            new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}};

            xBT2.setSequencesInOut(ref arBoolTemp, ref arCharTemp, ref arByteTemp,
                           ref arShortTemp, ref arUShortTemp, ref arLongTemp,
                           ref arULongTemp,ref arHyperTemp, ref arUHyperTemp,
                           ref arFloatTemp,ref arDoubleTemp, ref arEnumTemp,
                           ref arStringTemp, ref  arObjectTemp,
                           ref arAnyTemp, ref arLong2Temp, ref arLong3Temp);
            bRet = check(
            compareData(arBoolTemp, arBool) &&
            compareData(arCharTemp , arChar) &&
            compareData(arByteTemp , arByte) &&
            compareData(arShortTemp , arShort) &&
            compareData(arUShortTemp , arUShort) &&
            compareData(arLongTemp , arLong) &&
            compareData(arULongTemp , arULong) &&
            compareData(arHyperTemp , arHyper) &&
            compareData(arUHyperTemp , arUHyper) &&
            compareData(arFloatTemp , arFloat) &&
            compareData(arDoubleTemp , arDouble) &&
            compareData(arEnumTemp , arEnum) &&
            compareData(arStringTemp , arString) &&
            compareData(arObjectTemp , arObject) &&
            compareData(arAnyTemp , arAny) &&
            compareData(arLong2Temp , arLong3[0]) &&
            compareData(arLong3Temp , arLong3), "sequence test") && bRet;

            bool[] arBoolOut;
            char[] arCharOut;
            byte[] arByteOut;
            short[] arShortOut;
            UInt16[] arUShortOut;
            int[] arLongOut;
            UInt32[] arULongOut;
            long[] arHyperOut;
            UInt64[] arUHyperOut;
            float[] arFloatOut;
            double[] arDoubleOut;
            TestEnum[] arEnumOut;
            string[] arStringOut;
            Object[] arObjectOut;
            Any[] arAnyOut;
            int[][] arLong2Out;
            int[][][] arLong3Out;

            xBT2.setSequencesOut(out arBoolOut, out arCharOut, out arByteOut,
                         out arShortOut, out arUShortOut, out arLongOut,
                         out arULongOut, out arHyperOut, out arUHyperOut,
                         out arFloatOut, out arDoubleOut, out arEnumOut,
                         out arStringOut, out arObjectOut, out arAnyOut,
                         out arLong2Out, out arLong3Out);
            bRet = check(
            compareData(arBoolOut, arBool) &&
            compareData(arCharOut, arChar) &&
            compareData(arByteOut, arByte) &&
            compareData(arShortOut, arShort) &&
            compareData(arUShortOut, arUShort) &&
            compareData(arLongOut, arLong) &&
            compareData(arULongOut, arULong) &&
            compareData(arHyperOut, arHyper) &&
            compareData(arUHyperOut, arUHyper) &&
            compareData(arFloatOut, arFloat) &&
            compareData(arDoubleOut, arDouble) &&
            compareData(arEnumOut, arEnum) &&
            compareData(arStringOut, arString) &&
            compareData(arObjectOut, arObject) &&
            compareData(arAnyOut, arAny) &&
            compareData(arLong2Out, arLong3[0]) &&
            compareData(arLong3Out, arLong3), "sequence test") && bRet;
            }
            {
            //test with empty sequences
            int[][] _arLong2 = new int[0][];
            int[][] seqSeqRet = xBT2.setDim2(_arLong2);
            bRet = check( compareData(seqSeqRet, _arLong2), "sequence test") && bRet;
            int[][][] _arLong3 = new int[0][][];
            int[][][] seqSeqRet2 = xBT2.setDim3(_arLong3);
            bRet = check( compareData(seqSeqRet2, _arLong3), "sequence test") && bRet;
            Any[] _arAny = new Any[0];
            Any[] seqAnyRet = xBT2.setSequenceAny(_arAny);
            bRet = check( compareData(seqAnyRet, _arAny), "sequence test") && bRet;
            bool[] _arBool = new bool[0];
            bool[] seqBoolRet = xBT2.setSequenceBool(_arBool);
            bRet = check( compareData(seqBoolRet, _arBool), "sequence test") && bRet;
            byte[] _arByte = new byte[0];
            byte[] seqByteRet = xBT2.setSequenceByte(_arByte);
            bRet = check( compareData(seqByteRet, _arByte), "sequence test") && bRet;
            char[] _arChar = new char[0];
            char[] seqCharRet = xBT2.setSequenceChar(_arChar);
            bRet = check( compareData(seqCharRet, _arChar), "sequence test") && bRet;
            short[] _arShort = new short[0];
            short[] seqShortRet = xBT2.setSequenceShort(_arShort);
            bRet = check( compareData(seqShortRet, _arShort), "sequence test") && bRet;
            int[] _arLong = new int[0];
            int[] seqLongRet = xBT2.setSequenceLong(_arLong);
            bRet = check( compareData(seqLongRet, _arLong), "sequence test") && bRet;
            long[] _arHyper = new long[0];
            long[] seqHyperRet = xBT2.setSequenceHyper(_arHyper);
            bRet = check( compareData(seqHyperRet, _arHyper), "sequence test") && bRet;
            float[] _arFloat = new float[0];
            float[] seqFloatRet = xBT2.setSequenceFloat(_arFloat);
            bRet = check( compareData(seqFloatRet, _arFloat), "sequence test") && bRet;
            double[] _arDouble = new double[0];
            double[] seqDoubleRet = xBT2.setSequenceDouble(_arDouble);
            bRet = check( compareData(seqDoubleRet, _arDouble), "sequence test") && bRet;
            TestEnum[] _arEnum = new TestEnum[0];
            TestEnum[] seqEnumRet = xBT2.setSequenceEnum(_arEnum);
            bRet = check( compareData(seqEnumRet, _arEnum), "sequence test") && bRet;
            UInt16[] _arUShort = new UInt16[0];
            UInt16[] seqUShortRet = xBT2.setSequenceUShort(_arUShort);
            bRet = check( compareData(seqUShortRet, _arUShort), "sequence test") && bRet;
            UInt32[] _arULong = new UInt32[0];
            UInt32[] seqULongRet = xBT2.setSequenceULong(_arULong);
            bRet = check( compareData(seqULongRet, _arULong), "sequence test") && bRet;
            UInt64[] _arUHyper = new UInt64[0];
            UInt64[] seqUHyperRet = xBT2.setSequenceUHyper(_arUHyper);
            bRet = check( compareData(seqUHyperRet, _arUHyper), "sequence test") && bRet;
            Object[] _arObject = new Object[0];
            Object[] seqObjectRet = xBT2.setSequenceXInterface(_arObject);
            bRet = check( compareData(seqObjectRet, _arObject), "sequence test") && bRet;
            string[] _arString = new string[0];
            string[] seqStringRet = xBT2.setSequenceString(_arString);
            bRet = check( compareData(seqStringRet, _arString), "sequence test") && bRet;
            TestElement[] _arStruct = new TestElement[0];
            TestElement[] seqStructRet = xBT2.setSequenceStruct(_arStruct);
            bRet = check( compareData(seqStructRet, _arStruct), "sequence test") && bRet;

            }

            return bRet;
        }
コード例 #48
0
ファイル: ValueReplacer.cs プロジェクト: RalphC/NetMeter
 public void ReplaceValues(TestElement el)
 {
     List<NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new ReplaceStringWithFunctions(masterFunction,
             variables));
     SetProperties(el, newProps);
 }
コード例 #49
0
 /**
  * Add a test element.
  *
  * @param child
  *            the test element to add.
  */
 public override void AddTestElement(TestElement child)
 {
     GetSamplerController().AddTestElement(child);
 }
コード例 #50
0
ファイル: ValueReplacer.cs プロジェクト: RalphC/NetMeter
 public void undoReverseReplace(TestElement el)
 {
     List<NetMeterProperty> newProps = ReplaceValues(el.propertyIterator(), new UndoVariableReplacement(masterFunction,
             variables));
     SetProperties(el, newProps);
 }
コード例 #51
0
ファイル: LoopIterationEvent.cs プロジェクト: RalphC/NetMeter
 public LoopIterationEvent(TestElement source, Int32 iter)
 {
     this.iteration = iter;
     this.source = source;
 }
コード例 #52
0
 // TODO temporary hack to avoid unnecessary bug reports for subclasses
 /*
  * URGENT: TODO - sort out equals and hashCode() - at present equal
  * instances can/will have different hashcodes - problem is, when a proper
  * hashcode is used, tests stop working, e.g. listener data disappears when
  * switching views... This presumably means that instances currently
  * regarded as equal, aren't really equal.
  *
  * @see java.lang.Object#hashCode()
  */
 /**
  * {@inheritDoc}
  */
 public void addTestElement(TestElement el)
 {
     mergeIn(el);
 }
コード例 #53
0
ファイル: TestAgentBase.cs プロジェクト: RalphC/NetMeter
 public void AddTestElement(TestElement el)
 {
     //if (el instanceof CookieManager) {
     //    setCookieManager((CookieManager) el);
     //} else if (el instanceof CacheManager) {
     //    setCacheManager((CacheManager) el);
     //} else if (el instanceof HeaderManager) {
     //    setHeaderManager((HeaderManager) el);
     //} else if (el instanceof AuthManager) {
     //    setAuthManager((AuthManager) el);
     //} else {
     //    super.addTestElement(el);
     //}
 }
コード例 #54
0
 /**
  * Add to this the properties of element (by reference)
  * @param element {@link TestElement}
  */
 protected void mergeIn(TestElement element)
 {
     PropertyIterator iter = element.propertyIterator();
     while (iter.hasNext()) {
         NetMeterProperty prop = iter.next();
         addProperty(prop, false);
     }
 }
コード例 #55
0
ファイル: cli_cs_testobj.cs プロジェクト: zzz99977/core
        public TestDataElements setValues2(
        /*INOUT*/ref bool          io_bool,
        /*INOUT*/ref char             io_char,
        /*INOUT*/ref byte             io_byte,
        /*INOUT*/ref short            io_short,
        /*INOUT*/ref ushort            io_ushort,
        /*INOUT*/ref int              io_long,
        /*INOUT*/ref uint              io_ulong,
        /*INOUT*/ref long             io_hyper,
        /*INOUT*/ref ulong             io_uhyper,
        /*INOUT*/ref float            io_float,
        /*INOUT*/ref double           io_double,
        /*INOUT*/ref TestEnum         io_testEnum,
        /*INOUT*/ref String           io_string,
        /*INOUT*/ref Object           io_xInterface,
        /*INOUT*/ref Any           io_any,
        /*INOUT*/ref TestElement[]    io_testElements,
        /*INOUT*/ref TestDataElements io_testDataElements )
        {
            Debug.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any );

            _bool             = io_bool;
            _char             = io_char;
            _byte             = io_byte;
            _short            = io_short;
            _ushort           = io_ushort;
            _long             = io_long;
            _ulong            = io_ulong;
            _hyper            = io_hyper;
            _uhyper           = io_uhyper;
            _float            = io_float;
            _double           = io_double;
            _testEnum         = io_testEnum;
            _string           = io_string;
            _xInterface       = io_xInterface;
            _any              = io_any;
            _testElements     = (TestElement[]) io_testElements.Clone();
            _testDataElements = io_testDataElements;

            TestElement temp = io_testElements[ 0 ];
            io_testElements[ 0 ] = io_testElements[ 1 ];
            io_testElements[ 1 ] = temp;

            return _testDataElements;
        }
コード例 #56
0
ファイル: cli_cs_testobj.cs プロジェクト: zzz99977/core
 public TestElement[] setSequenceStruct(TestElement[] val)
 {
     _testElements = val;
     return val;
 }
コード例 #57
0
 private void GivenElementTarget(TestElement element)
 {
     Context.ElementTarget = element;
 }
コード例 #58
0
ファイル: cli_cs_testobj.cs プロジェクト: zzz99977/core
        public TestDataElements getValues(
        /*OUT*/out bool          o_bool,
        /*OUT*/out char             o_char,
        /*OUT*/out byte             o_byte,
        /*OUT*/out short            o_short,
        /*OUT*/out ushort            o_ushort,
        /*OUT*/out int              o_long,
        /*OUT*/out uint              o_ulong,
        /*OUT*/out long             o_hyper,
        /*OUT*/out ulong             o_uhyper,
        /*OUT*/out float            o_float,
        /*OUT*/out double           o_double,
        /*OUT*/out TestEnum         o_testEnum,
        /*OUT*/out String           o_string,
        /*OUT*/out Object           o_xInterface,
        /*OUT*/out Any           o_any,
        /*OUT*/out TestElement[]    o_testElements,
        /*OUT*/out TestDataElements o_testDataElements )
        {
            Debug.WriteLine( "##### " + GetType().FullName + ".getValues" );

            o_bool             = _bool;
            o_char             = _char;
            o_byte             = _byte;
            o_short            = _short;
            o_ushort           = _ushort;
            o_long             = _long;
            o_ulong            = _ulong;
            o_hyper            = _hyper;
            o_uhyper           = _uhyper;
            o_float            = _float;
            o_double           = _double;
            o_testEnum         = _testEnum;
            o_string           = _string;
            o_xInterface       = _xInterface;
            o_any              = _any;
            o_testElements     = _testElements;
            o_testDataElements = _testDataElements;

            return _testDataElements;
        }
コード例 #59
0
ファイル: cli_cs_testobj.cs プロジェクト: zzz99977/core
        //    private int _raiseAttr1;
        public void setValues(
        bool          bBool,
        char             cChar,
        byte             nByte,
        short            nShort,
        ushort            nUShort,
        int              nLong,
        uint              nULong,
        long             nHyper,
        ulong             nUHyper,
        float            fFloat,
        double           fDouble,
        TestEnum         testEnum,
        String           str,
        Object           xInterface,
        Any              any,
        TestElement []      testElements,
        TestDataElements testDataElements )
        {
            Debug.WriteLine( "##### " + GetType().FullName + ".setValues:" + any );

            _bool             = bBool;
            _char             = cChar;
            _byte             = nByte;
            _short            = nShort;
            _ushort           = nUShort;
            _long             = nLong;
            _ulong            = nULong;
            _hyper            = nHyper;
            _uhyper           = nUHyper;
            _float            = fFloat;
            _double           = fDouble;
            _testEnum         = testEnum;
            _string           = str;
            _xInterface       = xInterface;
            _any              = any;
            _testElements     = testElements;
            _testDataElements = testDataElements;
        }
コード例 #60
0
ファイル: ValueReplacer.cs プロジェクト: RalphC/NetMeter
 private void SetProperties(TestElement el, List<NetMeterProperty> newProps)
 {
     el.Clear();
     foreach (NetMeterProperty jmp in newProps)
     {
         el.SetProperty(jmp);
     }
 }