public void BeforeEachTest()
        {
            Project = TestObjectFactory.ProjectFile();
            TestLog = new TestLog();

            CheckOutService = new CheckoutServiceStub( TestLog );
            FileCopyService = new FileCopyServiceStub { ThrowException = false };
            ReferenceHintPathService = new ReferenceHintPathServiceStub( TestLog );
            ReferenceMover = new ReferenceMover.Core.ReferenceMover( CheckOutService, FileCopyService, ReferenceHintPathService );
        }
示例#2
0
            public static Tuple <int, Asset1, T1, T2, T3> TestStaticMethod <T3>(
                int a1, Asset1 a2, T1 a3, T2 a4, T3 a5,
                ref int ar1, ref Asset1 ar2, ref T1 ar3, ref T2 ar4, ref T3 ar5,
                out int ao1, out Asset1 ao2, out T1 ao3, out T2 ao4, out T3 ao5
                )
            {
                TestLog.Write(Events.TestStaticMethodEnter);

                ao1 = ar1;
                ao2 = ar2;
                ao3 = ar3;
                ao4 = ar4;
                ao5 = ar5;

                TestLog.Write(Events.TestStaticMethodExit);

                return(new Tuple <int, Asset1, T1, T2, T3>(a1, a2, a3, a4, a5));
            }
示例#3
0
        //[Variation(Priority = 0, Desc = "XElement - string content", Params = new object[] { "<B><A attr='a'>text</A></B>", "text" })]
        //[Variation(Priority = 1, Desc = "XElement - string content [cdata]", Params = new object[] { "<B><A attr='a'><![CDATA[cdata]]></A></B>", "cdata" })]
        //[Variation(Priority = 1, Desc = "XElement - string content [whitespace]", Params = new object[] { "<B><A attr='a'> </A></B>", " " })]
        public void elementWithText()
        {
            var xml      = Variation.Params[0] as string;
            var expValue = Variation.Params[1] as string;

            XElement e = XElement.Parse(xml, LoadOptions.PreserveWhitespace);

            e = e.DescendantsAndSelf("A").First();

            XNode ret = ((bool)Param) ? e.FirstNode : e.LastNode;

            TestLog.Compare(ret is XText, "Node is XText");
            TestLog.Compare((ret as XText).Value, expValue, "Node expected value");
            TestLog.Compare(ret.Parent.Equals(e), "Node.Parent");

            TestLog.Compare(ret.NextNode == null, "nextnode == null");
            TestLog.Compare(ret.PreviousNode == null, "Previousnode == null");
        }
示例#4
0
        private void GVMethod2CallTest <T, T1, T2>(double speedFactor)
        {
            Random            r  = RandomManager.CreateRandom(SeedVariatorType.CallingMethod);
            T                 o  = InstanceGeneratorProvider.Default.GetInstanceGenerator <T>().GetInstance(r);
            ContainerBase <T> c  = new Container <T>(o);
            IContainer <T>    ic = (IContainer <T>)c;
            Action            a1 = c.GenericMethod2 <T1, T2>;
            Action            a2 = ic.GenericMethod2 <T1, T2>;
            // Warmup
            int iterations = 100;

            CallClassGVMethod2 <T, T1, T2>(c, iterations);
            CallInterfaceGVMethod2 <T, T1, T2>(ic, iterations);
            a1.Invoke();
            a2.Invoke();
            CastClassGVMethod2 <T, T1, T2>(c, iterations);
            CastInterfaceGVMethod2 <T, T1, T2>(ic, iterations);
            // Real test
            iterations = (int)(IterationCount * speedFactor);
            TestLog.Info("Virtual generic call test (2 generic arguments: {0}, {1}):", typeof(T1).GetShortName(), typeof(T2).GetShortName());
            TestLog.Info("  Type: {0}", typeof(T).GetShortName());
            FastCache <T> .Value = null;
            using (IndentManager.IncreaseIndent()) {
                Cleanup();
                using (new Measurement("Generic method 2 (class)                 ", MeasurementOptions.Log, iterations))
                    CallClassGVMethod2 <T, T1, T2>(c, iterations);
                // Cleanup();
                using (new Measurement("Generic method 2 (class, by delegate)    ", MeasurementOptions.Log, iterations))
                    CallAction(a1, iterations);
                // Cleanup();
                using (new Measurement("Generic method 2 cast (class)            ", MeasurementOptions.Log, iterations))
                    CastClassGVMethod2 <T, T1, T2>(c, iterations);
                Cleanup();
                using (new Measurement("Generic method 2 (interface)             ", MeasurementOptions.Log, iterations))
                    CallInterfaceGVMethod2 <T, T1, T2>(ic, iterations);
                // Cleanup();
                using (new Measurement("Generic method 2 (interface, by delegate)", MeasurementOptions.Log, iterations))
                    CallAction(a2, iterations);
                // Cleanup();
                using (new Measurement("Generic method 2 cast (interface)        ", MeasurementOptions.Log, iterations))
                    CastInterfaceGVMethod2 <T, T1, T2>(ic, iterations);
                Cleanup();
            }
        }
        public void CheckInTeacher_SignIn_CheckIn_Teacher()
        {
            TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            String   churchCode         = test.CheckIn.ChurchCode;
            int      churchId           = base.SQL.Ministry_Church_FetchID(churchCode);
            String   timeZoneName       = base.SQL.Ministry_Activity_Instance_TimeZone(churchId);
            DateTime currentTimzoneTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timeZoneName));
            String   curentDate         = Convert.ToString(currentTimzoneTime.Year) + Convert.ToString(currentTimzoneTime.Month) + Convert.ToString(currentTimzoneTime.Day);
            int      interalHour        = 24 - currentTimzoneTime.Hour - 1;

            if (interalHour < 1)
            {
                TestLog.WriteLine("Time is not enough!");
            }
            string ministryName = "Bible Study";
            string activityName = "ActivityForCheckIn" + curentDate;

            TestLog.WriteLine("-activityName = {0}", activityName);
            String rosterNamepre = "RosterCheckIn" + curentDate;

            string[] rosterNameArray      = { rosterNamepre + "001", rosterNamepre + "002", rosterNamepre + "003", rosterNamepre + "004", rosterNamepre + "005" };
            string   activityScheduleName = "ScheduleForCheckIn" + curentDate;

            TestLog.WriteLine("-activityScheduleName = {0}", activityScheduleName);

            TestLog.WriteLine("Test Creates an attendance record  ---!");
            String url  = test.CheckIn.GetCheckInURl();
            String json = test.CheckIn.GenerateActiveCheckInJson(activityName, individualId, individualTypeId, rosterNameArray[0]);// grace1:30047327   grace2:30047329  grace3: 30047330 grace4:30047331 grace5:30048834

            TestLog.WriteLine("-createUrl = {0}", url);
            TestLog.WriteLine("-createJson = {0}", json);

            APIBase api            = new APIBase();
            String  responseString = api.SendAPIRequestwithBodyNoAuth(url, "POST", json, HttpStatusCode.Created);

            TestLog.WriteLine("-createResponseString = {0}", responseString);

            Assert.Contains(responseString, "{\"id\":");
            Assert.Contains(responseString, "\"url\":");
            attendenceId = test.CheckIn.GetValueByStrKey(responseString, "url", "attendances/");
            TestLog.WriteLine("-createAttendenceId = {0}", attendenceId);
            test.CheckIn.UpdateIndividual_Instance(activityName, individualId, 16729, checkInTime);
        }
        public void People_GroupEmail_Compose_SendViaDelegate()
        {
            string emailAddr   = "*****@*****.**";
            string password    = "******";
            string confirmAddr = "*****@*****.**";

            string emailRand = Guid.NewGuid().ToString().Substring(0, 7);
            string emailBody = string.Format("This is a test email sent from Portal - Delegate {0}", emailRand);

            // Login to portal using delegates credentials
            TestBase test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            TestLog.WriteLine("Add Delegate");
            test.Portal.Login("kevin.spacey", "FT4life!", "dc");

            //Delete all same delegate
            test.Portal.People_GroupEmail_Delegates_Delete_All("Tester, FT");

            // Add a delegate
            test.Portal.People_GroupEmail_Delegates_Create("Tester, FT");

            test.Portal.Logout();
            TestLog.WriteLine("Add Delegate Complete");

            TestLog.WriteLine("Send Delegate Email");
            test.Portal.Login("ft.tester", "FT4life!", "dc");

            // Compose an email via a delegate
            string emailTimeStamp = test.Portal.People_GroupEmail_Compose("Test email from Portal - Delegate", "Kevin Spacey", "*****@*****.**", new string[] { "FT Tester" }, emailBody, false, null, false);

            TestLog.WriteLine("Delegate Email sent at " + emailTimeStamp);

            // Logout of portal
            test.Portal.Logout();

            //Verify confirmation email was sent
            string emailSubject = test.Portal.getEmailSubject("Test email from Portal - Delegate");

            TestLog.WriteLine("Email Verify Subject: " + emailSubject);

            Message grpMsg = test.Portal.Retrieve_Search_Email(emailAddr, password, emailBody);

            test.Portal.Verify_Sent_Email(grpMsg, emailSubject, "\"Kevin Spacey\" <" + confirmAddr + ">", confirmAddr, new string[] { "FT Tester" }, emailBody);
        }
        public void People_GroupEmail_Compose_Send()
        {
            //Set conditions
            string emailAddr        = "*****@*****.**";
            string password         = "******";
            string _fromConfirmAddr = "*****@*****.**";
            string _infoEmail       = "*****@*****.**";
            string _fromAddr        = "\"FellowshipOne AutomatedTester01\" <" + _fromConfirmAddr + ">";
            string _replyTo         = emailAddr;
            string _confirmAddr     = _replyTo;

            string[] _recepients = new string[] { "FellowshipOne AutomatedTester01" };

            // Login to portal

            TestBase test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            test.Portal.Login("autotester01", "FT4life!", "dc");

            string emailRand = Guid.NewGuid().ToString().Substring(0, 7);
            string emailBody = string.Format("This is a test email sent from Portal {0}", emailRand);

            // Send an email to the designated recipient(s)
            string emailTimeStamp = test.Portal.People_GroupEmail_Compose("Test email from Portal", null, _replyTo, _recepients, emailBody, false, emailAddr, false);

            // Logout of portal
            test.Portal.Logout();

            TestLog.WriteLine("Enivornment: " + this.F1Environment.ToString());

            //Verify confirmation email was sent
            string emailSubject     = test.Portal.getEmailSubject("MTA TEST LICENSE - Your Email has been sent");
            string emailSubject2    = test.Portal.getEmailSubject("Test email from Portal");
            string confirmEmailBody = test.Portal.getConfirmEmailBody("FellowshipOne", "AutomatedTester01", "FellowshipOne", "AutomatedTester01", _infoEmail, emailTimeStamp, "Test email from Portal", false);

            Message msg = test.Portal.Retrieve_Search_Email(emailAddr, password, confirmEmailBody, true, emailSubject2);

            test.Portal.Verify_Confirmation_Email(msg, "Your email has been sent", _fromConfirmAddr, _fromConfirmAddr, _recepients, confirmEmailBody, emailSubject2);

            //Verify Group email was delivered
            Message grpMsg = test.Portal.Retrieve_Search_Email(emailAddr, password, emailBody);

            test.Portal.Verify_Sent_Email(grpMsg, emailSubject2, _fromAddr, _replyTo, _recepients, emailBody);
        }
                //[Variation(Priority = 0, Desc = "Multiple annotations on node - XDocument", Param = typeof(XDocument))]
                //[Variation(Priority = 0, Desc = "Multiple annotations on node - XElement", Param = typeof(XElement))]
                public void MultipleAnnotationsOnElement()
                {
                    Type       t   = CurrentChild.Param as Type;
                    string     xml = @"<A xmlns:p='a1'><B xmlns:q='a2'><C xmlns:p='a1'><D xmlns:q='a2' ><E xmlns:p='a1' /></D></C></B></A>";
                    XContainer reF = (t == typeof(XElement) ? XElement.Parse(xml) as XContainer : XDocument.Parse(xml) as XContainer);  // I want dynamics!!!

                    SaveOptions[] options = new SaveOptions[] { SaveOptions.None, SaveOptions.DisableFormatting, SaveOptions.OmitDuplicateNamespaces, SaveOptions.DisableFormatting | SaveOptions.OmitDuplicateNamespaces };

                    foreach (SaveOptions[] opts in Tuples2(options))
                    {
                        XContainer gp = (t == typeof(XElement) ? XElement.Parse(xml) as XContainer : XDocument.Parse(xml) as XContainer);
                        foreach (SaveOptions o in opts)
                        {
                            gp.AddAnnotation(o);
                        }
                        TestLog.Compare(reF.ToString(opts[0]), gp.ToString(), "On root - ToString()");
                        ReaderDiffNSAware.CompareNamespaceAware(opts[0], reF.CreateReader(), gp.CreateReader());
                    }
                }
                /*================== NewLineChars, IndentChars ==================*/

                //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, Entitize", Param = NewLineHandling.Entitize, Id = 29, Priority = 1)]
                //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, Replace", Param = NewLineHandling.Replace, Id = 30, Priority = 1)]
                //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, None", Param = NewLineHandling.None, Id = 31, Priority = 1)]
                public void EOF_Handling_11()
                {
                    XDocument d = new XDocument();
                    XmlWriter w = CreateWriter(d);

                    TestLog.Compare(w.Settings.NewLineChars, Environment.NewLine, "Incorect default value for XmlWriter.Settings.NewLineChars");
                    TestLog.Compare(w.Settings.IndentChars, "  ", "Incorect default value for XmlWriter.Settings.IndentChars");

                    w.WriteStartElement("root");
                    w.WriteStartElement("foo");
                    w.WriteElementString("bar", "");
                    w.WriteEndElement();
                    w.WriteEndElement();
                    w.Dispose();
                    if (!CompareReader(d, "<root>\r\n  <foo>\r\n    <bar />\r\n  </foo>\r\n</root>"))
                    {
                        throw new TestException(TestResult.Failed, "");
                    }
                }
示例#10
0
        // Remove standalone attribute
        // Remove the only attribute
        // Remove from multiple attributes - first, middle, last
        // Remove namespace decl {http://www.w3.org/2000/xmlns/}

        //[Variation(Priority = 1, Desc = "The only attribute, in Document", Params = new object[] { @"<A attr='1'/>", "attr", true })]
        //[Variation(Priority = 2, Desc = "The only attribute", Params = new object[] { @"<A attr='1'/>", "attr", false })]
        //[Variation(Priority = 0, Desc = "First attribute, in Document", Params = new object[] { @"<A attr='1' a2='a2' a3='a3'/>", "attr", true })]
        //[Variation(Priority = 2, Desc = "First attribute", Params = new object[] { @"<A attr='1' a2='a2' a3='a3'/>", "attr", false })]
        //[Variation(Priority = 0, Desc = "MIddle attribute, in Document", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "a2", true })]
        //[Variation(Priority = 2, Desc = "MIddle attribute", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "a2", false })]
        //[Variation(Priority = 1, Desc = "Last attribute, in Document", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "{ns}a3", true })]
        //[Variation(Priority = 2, Desc = "Last attribute", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "{ns}a3", false })]
        //[Variation(Priority = 1, Desc = "Remove namespace, in Document", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "{http://www.w3.org/2000/xmlns/}p", true })]
        //[Variation(Priority = 2, Desc = "Remove namespace", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' p:a3='pa3'/>", "{http://www.w3.org/2000/xmlns/}p", false })]
        //[Variation(Priority = 1, Desc = "Remove default namespace, in Document", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns='def' xmlns:p='ns' p:a3='pa3'/>", "xmlns", true })]
        //[Variation(Priority = 2, Desc = "Remove default namespace", Params = new object[] { @"<A attr='1' a2='a2' a3='a3' xmlns:p='ns' xmlns='def' p:a3='pa3'/>", "xmlns", false })]
        public void RemoveAttribute()
        {
            _runWithEvents = (bool)Params[0];
            var xml      = (string)Variation.Params[0];
            var attrName = (string)Variation.Params[1];
            var useDoc   = (bool)Variation.Params[2];

            XElement   elem = useDoc ? XDocument.Parse(xml).Root : XElement.Parse(xml);
            XAttribute a    = elem.Attribute(attrName);

            a.Verify();

            List <ExpectedValue> expValues = GetExpectedResults(elem, a).ToList();

            if (_runWithEvents)
            {
                _eHelper = new EventsHelper(elem);
            }
            a.Remove();
            if (_runWithEvents)
            {
                _eHelper.Verify(XObjectChange.Remove, a);
            }
            a.Verify();

            TestLog.Compare(a.Parent, null, "Parent after");
            TestLog.Compare(a.NextAttribute, null, "NextAttribute after");
            TestLog.Compare(a.PreviousAttribute, null, "PrevAttribute after");

            try
            {
                a.Remove();
                TestLog.Compare(false, "Exception was expected here");
            }
            catch (InvalidOperationException)
            {
                // Expected exception
            }

            TestLog.Compare(expValues.EqualAllAttributes(elem.Attributes(), Helpers.MyAttributeComparer), "The rest of the attributes");

            elem.Verify();
        }
        public static void Step(string name, Action action)
        {
            Exception ex = null;

            try
            {
                AllureReport.GetInstance().StepStarted(TestContext.CurrentContext.Test.FullName,
                                                       name);
                TestLog.WriteLine($"Step: {name}");
                action();
            }catch (Exception e) {
                ex = e;
            }
            finally
            {
                AllureReport.GetInstance().StepFinished(TestContext.CurrentContext.Test.FullName,
                                                        TestContext.CurrentContext.Result.Outcome.Status, ex);
            }
        }
示例#12
0
        //[Variation(Priority = 0, Desc = "IsEmpty propert Manipulation II.")]
        public void IsEmptyProp2()
        {
            var e = new XElement("e", "");

            TestLog.Compare(!e.IsEmpty, "Initial - empty");
            TestLog.Compare(e.Value, "", "value 0");

            e.Add("");
            TestLog.Compare(!e.IsEmpty, "Initial - after Add");
            TestLog.Compare(e.Value, "", "value 1");

            e.RemoveNodes();
            TestLog.Compare(e.IsEmpty, "Initial - after RemoveNodes 1");
            TestLog.Compare(e.Value, "", "value 2");

            e.Add("");
            TestLog.Compare(!e.IsEmpty, "Initial - after Add");
            TestLog.Compare(e.Value, "", "value 3");
        }
示例#13
0
        public static void SystemState(string message)
        {
            message = string.Format(">>> {0}", message);

            if (Config.LogStepsDiagnosticOutput)
            {
                if (Config.LogSystemState)
                {
                    DiagnosticLog.WriteLine(message);
                }
            }
            if (Config.LogStepsTestReport)
            {
                if (Config.LogSystemState)
                {
                    TestLog.WriteLine(message);
                }
            }
        }
示例#14
0
                //[Variation(Id = 1, Desc = "WriteDocType should error when CL=fragment", Priority = 1)]
                public void frag_1()
                {
                    XElement d = new XElement("a");

                    using (XmlWriter w = d.CreateWriter())
                    {
                        try
                        {
                            w.WriteDocType("ROOT", "publicid", "sysid", "<!ENTITY e 'abc'>");
                        }
                        catch (InvalidOperationException)
                        {
                            TestLog.Compare(w.WriteState, WriteState.Error, "WriteState should be Error");
                            return;
                        }
                    }
                    TestLog.WriteLine("Did not throw exception");
                    throw new TestException(TestResult.Failed, "");
                }
示例#15
0
 //[Variation(Desc = "Other APIs")]
 public void Variation6()
 {
     foreach (XNode n in GetXNodeR())
     {
         using (XmlReader r = n.CreateReader())
         {
             r.MoveToContent();
             TestLog.Compare(r.MoveToElement(), false, "Error");
             TestLog.Compare(r.MoveToFirstAttribute(), false, "Error");
             TestLog.Compare(r.MoveToNextAttribute(), false, "Error");
             TestLog.Compare(r.ReadAttributeValue(), false, "Error");
             r.Read();
             TestLog.Compare(r.ReadInnerXml(), "", "Error");
             r.ReadOuterXml();
             r.ResolveEntity();
             r.Skip();
         }
     }
 }
        public void OnXElement2()
        {
            int count = 0;

            _runWithEvents = (bool)Params[0];
            var e = new XElement("A", new XText(""));

            TestLog.Compare(e.Nodes().Any(), "Test failed:: e.Nodes().Any()");
            if (_runWithEvents)
            {
                _eHelper = new EventsHelper(e);
                count    = e.Nodes().Count();
            }
            VerifyRemoveNodes(e);
            if (_runWithEvents)
            {
                _eHelper.Verify(XObjectChange.Remove, count);
            }
        }
                //[Variation(Priority = 0, Desc = "XElement - same name", Params = new object[] { "<element>value</element>", "element" })]
                //[Variation(Priority = 0, Desc = "XElement - different name", Params = new object[] { "<element>value</element>", "newElement" })]
                //[Variation(Priority = 0, Desc = "XElement - name with namespace", Params = new object[] { "<element>value</element>", "{a}newElement" })]
                //[Variation(Priority = 0, Desc = "XElement - name with xml namespace", Params = new object[] { "<element>value</element>", "{http://www.w3.org/XML/1998/namespace}newElement" })]
                //[Variation(Priority = 0, Desc = "XElement - element with namespace", Params = new object[] { "<p:element xmlns:p='mynamespace'><p:child>value</p:child></p:element>", "{a}newElement" })]
                public void ValidVariation()
                {
                    _runWithEvents = (bool)Params[0];
                    string   xml      = Variation.Params[0] as string;
                    XElement toChange = XElement.Parse(xml);
                    XName    newName  = Variation.Params[1] as string;

                    if (_runWithEvents)
                    {
                        _eHelper = new EventsHelper(toChange);
                    }
                    toChange.Name = newName;
                    if (_runWithEvents)
                    {
                        _eHelper.Verify(XObjectChange.Name);
                    }
                    TestLog.Compare(newName.Namespace == toChange.Name.Namespace, "Namespace did not change");
                    TestLog.Compare(newName.LocalName == toChange.Name.LocalName, "LocalName did not change");
                }
示例#18
0
                //[Variation("Subtree Reader caches the NodeType and reports node type of Attribute on subsequent reads.", Priority = 1)]
                public void SubtreeReaderCachesNodeTypeAndReportsNodeTypeOfAttributeOnSubsequentReads()
                {
                    string    xmlStr     = "<root xmlns='foo'><b blah='blah'/><b/></root>";
                    XmlReader DataReader = GetReader(new StringReader(xmlStr));

                    PositionOnElement(DataReader, "root");
                    XmlReader xxr = DataReader.ReadSubtree();

                    //Now on root.
                    xxr.Read();
                    TestLog.Compare(xxr.Name, "root", "Root Elem");
                    TestLog.Compare(xxr.MoveToNextAttribute(), true, "MTNA 1");

                    TestLog.Compare(xxr.NodeType, XmlNodeType.Attribute, "XMLNS NT");
                    TestLog.Compare(xxr.Name, "xmlns", "XMLNS Attr");
                    TestLog.Compare(xxr.Value, "foo", "XMLNS Value");
                    TestLog.Compare(xxr.MoveToNextAttribute(), false, "MTNA 2");

                    //Now on b.
                    xxr.Read();
                    TestLog.Compare(xxr.Name, "b", "b Elem");
                    TestLog.Compare(xxr.MoveToNextAttribute(), true, "MTNA 3");

                    TestLog.Compare(xxr.NodeType, XmlNodeType.Attribute, "blah NT");
                    TestLog.Compare(xxr.Name, "blah", "blah Attr");
                    TestLog.Compare(xxr.Value, "blah", "blah Value");
                    TestLog.Compare(xxr.MoveToNextAttribute(), false, "MTNA 4");

                    // Now on /b.
                    xxr.Read();
                    TestLog.Compare(xxr.Name, "b", "b EndElem");
                    TestLog.Compare(xxr.NodeType, XmlNodeType.Element, "b Elem NT");
                    TestLog.Compare(xxr.MoveToNextAttribute(), false, "MTNA 5");

                    xxr.Read();
                    TestLog.Compare(xxr.Name, "root", "root EndElem");
                    TestLog.Compare(xxr.NodeType, XmlNodeType.EndElement, "root EndElem NT");
                    TestLog.Compare(xxr.MoveToNextAttribute(), false, "MTNA 6");

                    xxr.Dispose();

                    DataReader.Dispose();
                }
示例#19
0
                protected void TestOnNopNodeType(XmlNodeType nt)
                {
                    XmlReader DataReader = GetReader(pBase64Xml);

                    PositionOnNodeType(DataReader, nt);
                    string name  = DataReader.Name;
                    string value = DataReader.Value;

                    if (!DataReader.CanReadBinaryContent)
                    {
                        return;
                    }

                    byte[] buffer = new byte[1];
                    int    nBytes = DataReader.ReadContentAsBase64(buffer, 0, 1);

                    TestLog.Compare(nBytes, 0, "nBytes");
                    TestLog.Compare(VerifyNode(DataReader, nt, name, value), "vn");
                }
        public void Type(string text)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();


            WebDriverWait wait = new WebDriverWait(new SystemClock(), _pageElement.WebDriver, _timeOut, new TimeSpan(0, 0, 0, 0, 500))
            {
                Message = GetErrorMessage()
            };

            for (int i = 0; i < 3; i++)
            {
                Thread.Sleep(300);
                wait.Until(InputIsEmptyOrNotExampleText);
            }
            stopwatch.Stop();
            TestLog.Add("Waited " + stopwatch.ElapsedMilliseconds + " milliseconds for input-field to be empty.");
            _fillBehaviour.Type(text);
        }
示例#21
0
                public void ExecuteXDocumentVariation()
                {
                    XNode     toReplace    = Variation.Params[0] as XNode;
                    XNode     newValue     = Variation.Params[1] as XNode;
                    XDocument xDoc         = new XDocument(toReplace);
                    XDocument xDocOriginal = new XDocument(xDoc);

                    using (UndoManager undo = new UndoManager(xDoc))
                    {
                        undo.Group();
                        using (EventsHelper docHelper = new EventsHelper(xDoc))
                        {
                            toReplace.ReplaceWith(newValue);
                            docHelper.Verify(new XObjectChange[] { XObjectChange.Remove, XObjectChange.Add }, new XObject[] { toReplace, newValue });
                        }
                        undo.Undo();
                        TestLog.Compare(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
                    }
                }
示例#22
0
                //[Variation("Read after partial ReadBinHex")]
                public void TestReadBinHex_16()
                {
                    XmlReader DataReader = GetReader(pBinHexXml);

                    PositionOnElement(DataReader, "ElemNum");
                    DataReader.Read();
                    if (!DataReader.CanReadBinaryContent)
                    {
                        return;
                    }

                    byte[] buffer = new byte[10];
                    int    nRead  = DataReader.ReadContentAsBinHex(buffer, 0, 8);

                    TestLog.Compare(nRead, 8, "0");

                    DataReader.Read();
                    TestLog.Compare(VerifyNode(DataReader, XmlNodeType.Element, "ElemText", String.Empty), "1vn");
                }
示例#23
0
                //[Variation(Priority = 0, Desc = "XElement - BaseUri, Reader in Initial state, all nodes", Param = @"TestData\XLinq\IXmlLineInfoTests\company-data.xml")]
                public void AllNodesTests()
                {
                    string fileName = CurrentChild.Param as string;

                    using (XmlReader r = XmlReader.Create(FilePathUtil.getStream(fileName), new XmlReaderSettings()
                    {
                        DtdProcessing = DtdProcessing.Ignore
                    }))
                    {
                        XDocument doc = XDocument.Load(r, LoadOptions.SetBaseUri);
                        foreach (XNode node in doc.DescendantNodes())
                        {
                            using (XmlReader testReader = node.CreateReader())
                            {
                                TestLog.Compare(node.BaseUri, testReader.BaseURI, "Wrong baseURI in intial state");
                            }
                        }
                    }
                }
示例#24
0
        public void DingDanGuanLiCase002()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver, LogWrite);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(5000);

                //验证订单管理全部订单链接存在并点击
                Log.Info("验证订单管理全部订单链接");
                driver.FindElement(By.XPath("//ul/li/div[2]/dl[1]/dd[1]/a")).Click();
                Thread.Sleep(MinSleepTime);
                //验证跳转链接正确
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[1]/h3")).Text, "待完成的订单", "验证跳转链接是否正确");
                //设置时间区间显示订单数
                TestLog.WriteLine("验证不同时间区间订单显示");
                TestLog.WriteLine("检查已完成订单");
                TestLog.WriteLine("检查最近一个月已完成订单数");
                String notendtext = driver.FindElement(By.Id("h3_contianerF")).Text;
                int    flagA      = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagA >= 0);
                TestLog.WriteLine("检查最近三个月已完成订单数");
                SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近3个月订单");
                Thread.Sleep(MIDSleepTime);
                int flagB = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagB >= flagA);
                TestLog.WriteLine("检查最近一年已完成订单数");
                SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近1年订单");
                Thread.Sleep(MIDSleepTime);
                int flagC = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagC >= flagA);
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
示例#25
0
        /// <summary>
        /// Updates test log in "context".
        /// </summary>
        public void UpdateTestLog()
        {
            TestLog log = new TestLog();

            log.TestResults           = _testResults;
            log.Features              = _td.Features;
            log.TestExecutionTime     = _testExecutionTime;
            log.InitializationData    = _initializationData;
            log.FeaturesDefinitionLog = _featureDefinitionLog;

            log.Timeouts = new RealTimeouts();
            TrafficListener.GetAggregated(out log.Timeouts.Maximum, out log.Timeouts.Median, out log.Timeouts.Average);
            System.Diagnostics.Debug.WriteLine(string.Format("RunTests stopped with Max={0}, Median={1} and Mean={2}",
                                                             log.Timeouts.Maximum,
                                                             log.Timeouts.Median,
                                                             log.Timeouts.Average));

            ContextController.UpdateTestLog(log);
        }
示例#26
0
        public void CheckInTeacher_Settings_CheckSSO_Mobile()
        {
            TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            TestLog.WriteLine("Log in Teacher project");
            test.CheckIn.LoginMobileWebDriver();

            TestLog.WriteLine("Check SSO icon displays well");
            test.GeneralMethods.WaitForElement(By.CssSelector("[ng-controller=\"LauncherController\"]"));
            TestLog.WriteLine("Click SSO icon");
            test.Driver.FindElementByCssSelector("[class=\"nav-bar-block\"][nav-bar=\"active\"]").FindElement(By.CssSelector("[class=\"NineGrid-img\"]")).Click();

            test.GeneralMethods.WaitForElement(By.CssSelector("[class=\"NineGrid-apps-list\"]"));
            test.GeneralMethods.WaitForElement(By.CssSelector("[class=\"NineGrid-img NineGrid-img--prom\"]"));
            test.Driver.FindElementByCssSelector("[class=\"nav-bar-block\"][nav-bar=\"active\"]").FindElement(By.CssSelector("[class=\"NineGrid-img NineGrid-img--prom\"]")).Click();

            //Logout
            test.CheckIn.LogoutWebDriver();
        }
示例#27
0
        public static void Info(string message)
        {
            message = string.Format("|   {0}", message);

            if (Config.LogStepsDiagnosticOutput)
            {
                if (Config.LogInfoMessages)
                {
                    DiagnosticLog.WriteLine(message);
                }
            }
            if (Config.LogStepsTestReport)
            {
                if (Config.LogInfoMessages)
                {
                    TestLog.WriteLine(message);
                }
            }
        }
示例#28
0
        public LoginPage ChangeLanguage(string language)
        {
            if (dropdown_Language.IsElementPresent())
            {
                dropdown_Language.Click();
                switch (language)
                {
                case "English":
                    dropdownOption_English.Click();
                    break;

                case "Español":
                    dropdownOption_Espanol.Click();
                    break;

                case "Português":
                    dropdownOption_Portugues.Click();
                    break;

                case "Deutsch":
                    dropdownOption_Deutsch.Click();
                    break;

                case "Français":
                    dropdownOption_Francais.Click();
                    break;

                case "中文":
                    dropdownOption_Chinese.Click();
                    break;

                case "日本語":
                    dropdownOption_Japanese.Click();
                    break;
                }

                if (language == Driver.FindElement(dropdown_Language).Text.Trim())
                {
                    TestLog.Pass("Language changed to: " + language);
                }
            }
            return(this);
        }
示例#29
0
        //[Variation(Priority = 0, Desc = "(BVT)XElement - multiple nodes, connected", Params = new object[] { true, 2 })]
        //[Variation(Priority = 0, Desc = "(BVT)XElement - multiple nodes, not connected", Params = new object[] { false, 2 })]
        //[Variation(Priority = 1, Desc = "XElement - multiple nodes, connected", Params = new object[] { true, 4 })]
        //[Variation(Priority = 1, Desc = "XElement - multiple nodes, not connected", Params = new object[] { false, 4 })]
        //[Variation(Priority = 0, Desc = "XElement - single node, connected", Params = new object[] { true, 1 })]
        //[Variation(Priority = 0, Desc = "XElement - single node, not connected", Params = new object[] { false, 1 })]

        //[Variation(Priority = 2, Desc = "XElement - build from Query result")]

        public void BuildFromQuery()
        {
            var mode = (InputParamStyle)Param;

            XElement e1 = XElement.Parse(@"<A><B id='a1'/><B id='a2'/><B id='a4'/></A>");
            XElement e2 = XElement.Parse(@"<root><a1 a='a'/><a2/><a3 b='b'/><a4 c='c'/><a5/><a6/><a7/><a8/></root>");

            IEnumerable <XElement> nodes = from data1 in e1.Elements() join data2 in e2.Elements() on data1.Attribute("id").Value equals data2.Name.LocalName select data2;

            IEnumerable <XAttribute> attributes = from data1 in e1.Elements() join data2 in e2.Elements() on data1.Attribute("id").Value equals data2.Name.LocalName select data2.FirstAttribute;

            IEnumerable <ExpectedValue> expectedContent    = ExpectedContent(nodes).ProcessNodes().ToList();
            IEnumerable <ExpectedValue> expectedAttributes = ExpectedContent(attributes).Where(n => n.Data is XAttribute).ToList();

            XElement e = CreateElement(mode, nodes.OfType <object>().Concat(attributes.OfType <object>()));

            TestLog.Compare(expectedContent.EqualAll(e.Nodes(), XNode.EqualityComparer), "Content");
            TestLog.Compare(expectedAttributes.EqualAllAttributes(e.Attributes(), Helpers.MyAttributeComparer), "Attributes");
        }
示例#30
0
        public void GetTests()
        {
            using (var repository = new UnmanagedTestRepository(resources))
            {
                Assert.IsTrue(repository.IsValid);
                TestInfoData[] items = repository.GetTests().ToArray();
                Assert.IsNotEmpty(items);

                using (TestLog.BeginSection(String.Format("Found {0} test item(s):", items.Length)))
                {
                    foreach (TestInfoData item in items)
                    {
                        DiagnosticLog.WriteLine("{0}: Fixture={1}, Test={2}, Row={3}, Kind={4}",
                                                item.Name, item.Native.Position.pTestFixture, item.Native.Position.pTest,
                                                item.Native.Position.pRow, item.Kind);
                    }
                }
            }
        }
示例#31
0
                //[Variation(Id = 2, Desc = "WriteStartDocument() should error when CL=fragment", Priority = 1)]
                public void frag_2()
                {
                    XElement d = new XElement("a");

                    using (XmlWriter w = d.CreateWriter())
                    {
                        try
                        {
                            w.WriteStartDocument();
                        }
                        catch (InvalidOperationException)
                        {
                            TestLog.Compare(w.WriteState, WriteState.Error, "WriteState should be Error");
                            return;
                        }
                    }
                    TestLog.WriteLine("Did not throw exception");
                    throw new TestException(TestResult.Failed, "");
                }
示例#32
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
 {
     TestLog ds = new TestLog();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length)
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
示例#33
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
 {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     TestLog ds = new TestLog();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "LogEntryDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length)
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public CheckoutServiceStub( TestLog testLog )
 {
     _testLog = testLog;
 }
 public ReferenceHintPathServiceStub( TestLog testLog )
 {
     _testLog = testLog;
 }