Provide the context information of the current test. This is an adapter for the internal ExecutionContext class, hiding the internals from the user test.
コード例 #1
0
ファイル: ValueTests.cs プロジェクト: tocsoft/Linq2OData
 public void Guid()
 {
     var ctx = new TestContext<Models.TestObject>();
     var guid = new System.Guid("61CA9677-CABA-44A0-A187-7C86A8E0EAC3");
     ctx.Queryable.Where(x => x.guidProperty == guid).ToList();
     Assert.AreEqual("guidProperty eq guid'61ca9677-caba-44a0-a187-7c86a8e0eac3'", ctx.LastRequest.Parsed.Filter);
 }
コード例 #2
0
 public void TestMethod1()
 {
     driver.Url = "https://www.google.com/";
     driver.FindElement(By.Name("q")).SendKeys("Selenium");
     Console.WriteLine("Console.");
     TestContext.WriteLine("Context");
 }
コード例 #3
0
ファイル: ValueTests.cs プロジェクト: tocsoft/Linq2OData
 public void Guid_null()
 {
     var ctx = new TestContext<Models.TestObject>();
     Guid? guid = null;
     ctx.Queryable.Where(x => x.guidNullProperty == guid).ToList();
     Assert.AreEqual("guidNullProperty eq null", ctx.LastRequest.Parsed.Filter);
 }
        public void GetTestDataFromResxResourceTest()
        {
            this.SchoolNet().LoadWebPage();
            try
            {
                QuestionAnswerData questionAnswerData = new QuestionAnswerData();
                questionAnswerData.GetTestDataFromResxResource("UITests.Data.Assess.ItemCreateEdit.MultipleChoiceItemResource",
                                                               "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);

                Assert.AreEqual(ItemType.MultipleChoice, questionAnswerData.ItemType, "The item type is incorrect.");
                Assert.AreEqual(MultipleChoiceLayout.OneColumn, questionAnswerData.AnswerChoiceLayoutOption, "The answer choice layout is incorrect.");
                Assert.IsTrue(questionAnswerData.PointValuePair.ContainsKey("blue"), "The point value key is incorrect.");
                Assert.IsTrue(questionAnswerData.PointValuePair.ContainsValue("5"), "The point value is incorrect.");

                List <string> list = new List <string>();
                list.Add("blue");
                int i = 0;
                foreach (var item in questionAnswerData.CorrectAnswerList)
                {
                    Assert.AreEqual(item, list[i], "The correct answer list is incorrect.");
                    i++;
                }

                list.Add("purple");
                list.Add("yellow");
                list.Add("orange");
                i = 0;
                foreach (var item in questionAnswerData.AnswerList)
                {
                    Assert.AreEqual(item, list[i], "The answer list is incorrect.");
                    i++;
                }

                list.Remove("blue");
                list.Remove("purple");
                list.Remove("yellow");
                list.Remove("orange");
                list.Add("teacher's explanation");
                i = 0;
                foreach (var item in questionAnswerData.TeacherExplanationList)
                {
                    Assert.AreEqual(item, list[i], "The teacher explanation list is incorrect.");
                    i++;
                }

                list.Remove("teacher's explanation");
                list.Add("student's explanation");
                i = 0;
                foreach (var item in questionAnswerData.StudentExplanationList)
                {
                    Assert.AreEqual(item, list[i], "The teacher explanation list is incorrect.");
                    i++;
                }
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
        public void GetDummyElementsHeaderRowsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                int    expectedNumber = 0;
                int    actualNumber   = 0;
                string expected       = null;
                string actual         = null;

                expectedNumber = 1;
                actualNumber   = ProfileHomeInProgressTestsGrid.GetDummyElementsHeaderRows().Count();
                Assert.AreEqual(expectedNumber, actualNumber, "Assess Dashboard In-Progress Tests Grid Dummy Header Rows List does not have the correct number of Header Rows.");

                expected = "<th>Test Name</th><th>End Date</th><th>Scores Due Date</th><th>Collection Status</th>";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsHeaderRows()[0].Text;
                Assert.AreEqual(expected, actual, "First Row in the Assess Dashboard In-Progress Tests Grid Dummy Header Rows List does not have the correct text.");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #6
0
        public void When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var laird = context.CreateCard<KoboldHumanoid>("Drakeclan Laird");
            var ambusher = context.CreateCard<KoboldHumanoid>("Drakeclan Ambusher");
            var cutter = context.CreateCard<KoboldHumanoid>("Drakeclan Cutter");
            var shaman = context.CreateCard<KoboldHumanoid>("Drakeclan Shaman");
            var kobolds = new[] {laird, ambusher, cutter, shaman};
            context.SetTopOfDungeonDeck(kobolds);
            context.AdvanceMonsterToFirstRank(laird);
            var hand = Enumerable.Range(0, 6).Select(x => context.CreateCard<Criochan>("Criochan Captain")).ToArray();
            context.SetPlayerHand(hand);
            var startingXp = player.Xp;
            var startingVp = player.Vp;

            // Act
            context.WhenBattling(laird);
            player.DetermineBattleResult();

            // Assert
            kobolds.Each(x => Assert.That(player.Discard.Contains(x), "Discard does not contain {0}".Template(x.Name)));
            context.Game.Dungeon.Ranks.Each(r=> Assert.That(r.Card, Is.Not.Null, "Rank {0} is empty".Template(r.Number)));
            kobolds.Each(x => Assert.That(context.Game.Dungeon.Ranks.All(rank => rank.Card != x)));
            Assert.That(player.Xp, Is.EqualTo(startingXp + laird.Xp));
            Assert.That(player.Vp, Is.EqualTo(startingVp + kobolds.Sum(x => x.Vp)));
        }
コード例 #7
0
        public static void CopyAndAttachDatabase(TestContext context, string databaseName)
        {
            string destinationPath = CopyDatabase(context, databaseName);

            // Attach the copied database to SQL Server
            AttachDatabase(databaseName, destinationPath);
        }
コード例 #8
0
        /// <summary>
        /// Gets the full file path of an existing output file in the execution environment
        /// </summary>
        /// <returns>The full path to the file.</returns>
        /// <param name="testContext">The test context from which to attempt to extract the path</param>
        /// <param name="filename">The filename without path</param>
        public static string GetExecutionFilepath(string filename, TestContext testContext = null)
        {
            string[] paths = new string[] {
            Path.GetFullPath(filename),
            BuildPathFromCodeBaseDir(filename),
            BuildPathFromCurrentDir(filename),
            BuildPathFromDomainDir(filename),
            BuildPathFromStackFrame(filename),
            testContext != null ?
              BuildPathFromTestDeployment(filename, testContext) :
              INEXISTANT_FILE,
            testContext != null ?
              BuildPathFromTestDir(filename, testContext) :
              INEXISTANT_FILE,
              };

              foreach (string path in paths)
              {
            if (FileExists(path))
            {
              return path;
            }
              }

              throw new FileNotFoundException(string.Format("{0} not found.", filename));
        }
コード例 #9
0
ファイル: TphTest.cs プロジェクト: kjbartel/efmappingapi
        public void Contract_Contract()
        {
            using (var ctx = new TestContext())
            {
                var map = ctx.Db<Contract>();

                var columns = map.Properties;
                Assert.AreEqual(19, columns.Length);

                map.Prop(x => x.Id)
                    .IsIdentity()
                    .IsFk(false)
                    .IsDiscriminator(false)
                    .IsRequired()
                    .HasColumnName("Id");

                map.Prop(x => x.AvpContractNr)
                    .IsIdentity(false)
                    .IsFk(false)
                    .IsDiscriminator(false)
                    .IsRequired(false)
                    .HasColumnName("AvpContractNr")
                    .MaxLength(50);
            }
        }
コード例 #10
0
        public void Create_Passage_With_Publisher()
        {
            try
            {
                this.SchoolNet().LoadWebPage();

                Workflows workflows = new Workflows();
                workflows.SignInAsDistrictAdmin();

                TestContext.WriteLine("\n--- Create a passage ---");
                workflows.AssessWorkflows.PassageWorkflows
                .NavigateToCreatePassagePage();

                //set up data for EditPassage.aspx
                EditPassageData editPassageData = workflows.AssessWorkflows.EditPassagePage.InitData();
                editPassageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.Passage.PassageResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPassageData.Title     = "OriginalAutomationPassage";
                editPassageData.Publisher = "OriginalAutomationPassage_Publisher";
                workflows.AssessWorkflows.EditPassagePage.Data = editPassageData;

                workflows.AssessWorkflows.PassageWorkflows
                .CreatePassagePageInputFormFields();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
コード例 #11
0
ファイル: ItTests.cs プロジェクト: tocsoft/Linq2OData
        public void It()
        {
            var ctx = new TestContext<string>();

            ctx.Queryable.Where(x=>x.EndsWith("")).ToList();

            Assert.AreEqual("endswith($it, '')", ctx.LastRequest.Parsed.Filter);
        }
コード例 #12
0
        public void startswith()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.StartsWith("big")).ToList();

            Assert.AreEqual("startswith(stringProperty, 'big')", ctx.LastRequest.Parsed.Filter);
        }
コード例 #13
0
        public void indexof()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.IndexOf("test") == 1).ToList();

            Assert.AreEqual("indexof(stringProperty, 'test') eq 1", ctx.LastRequest.Parsed.Filter);
        }
コード例 #14
0
        public void round()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => Math.Round(x.floatProperty) == 0).ToList();

            Assert.AreEqual("round(floatProperty) eq 0", ctx.LastRequest.Parsed.Filter);
        }
コード例 #15
0
        public void fractionalseconds()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.dateProperty.Second == 0).ToList();

            Assert.AreEqual("fractionalseconds(dateProperty) eq 0", ctx.LastRequest.Parsed.Filter);
        }
コード例 #16
0
        public void toLower()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.ToLower() == "").ToList();

            Assert.AreEqual("tolower(stringProperty) eq ''", ctx.LastRequest.Parsed.Filter);
        }
コード例 #17
0
        public void MinValue()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => DateTime.MinValue == x.dateProperty).ToList();

            Assert.AreEqual("mindatetime() eq dateProperty", ctx.LastRequest.Parsed.Filter);
        }
コード例 #18
0
        public void minute()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.dateProperty.Minute == 0).ToList();

            Assert.AreEqual("minute(dateProperty) eq 0", ctx.LastRequest.Parsed.Filter);
        }
コード例 #19
0
ファイル: TestSandbox.cs プロジェクト: nHook/nH.Api
		private static void DeleteSandboxDirectory(TestContext context)
		{
			var sandbox = Path.Combine(context.TestDirectory, "sandbox");
			if (Directory.Exists(sandbox))
			{
				Directory.Delete(sandbox, true);
			}
		}
コード例 #20
0
ファイル: UnitTest1.cs プロジェクト: t38t3r/jenkinstest
            public void performActionsByWorksheet()
            {
                string excelFilePath = TestContext.Parameters["excelFilePath"];
                string worksheetName = TestContext.Parameters["worksheetName"];

                TestContext.WriteLine(excelFilePath);
                TestContext.WriteLine(worksheetName);
            }
コード例 #21
0
        public void concat()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty + "test" == "propTest").ToList();

            Assert.AreEqual("concat(stringProperty, 'test') eq 'propTest'", ctx.LastRequest.Parsed.Filter);
        }
コード例 #22
0
        public void length()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty.Length == 1).ToList();

            Assert.AreEqual("length(stringProperty) eq 1", ctx.LastRequest.Parsed.Filter);
        }
コード例 #23
0
ファイル: OperationTests.cs プロジェクト: tocsoft/Linq2OData
        public void AndSingleAmp()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.boolProperty & x.secondBoolProperty).ToList();

            Assert.AreEqual("boolProperty and secondBoolProperty", ctx.LastRequest.Parsed.Filter);
        }
コード例 #24
0
ファイル: OperationTests.cs プロジェクト: tocsoft/Linq2OData
        public void Division()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.intProperty / x.intProperty > x.secondIntProperty).ToList();

            Assert.AreEqual("(intProperty div intProperty) gt secondIntProperty", ctx.LastRequest.Parsed.Filter);
        }
コード例 #25
0
ファイル: OperationTests.cs プロジェクト: tocsoft/Linq2OData
        public void GreaterThanOrEqual()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.intProperty >= x.secondIntProperty).ToList();

            Assert.AreEqual("intProperty ge secondIntProperty", ctx.LastRequest.Parsed.Filter);
        }
コード例 #26
0
        public void read_incorrectly_formatted_step_value_increments_syntax_error()
        {
            Step step = new Step().With("DistanceFromOffice:abc");
            var context = new TestContext();

            match.ReadExpected(context, step, new SetRow());

            context.Counts.ShouldEqual(0, 0, 0, 1);
        }
コード例 #27
0
        public void OrdererdResults()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => Math.Round(x.floatProperty) == 0).OrderByDescending(x=>x.floatProperty).ToList();

            Assert.AreEqual("round(floatProperty) eq 0", ctx.LastRequest.Parsed.Filter);
            Assert.AreEqual("floatProperty desc", ctx.LastRequest.Parsed.OrderBy);
        }
コード例 #28
0
        public void SetUp()
        {
            grammar = CheckPropertyGrammar.For<CheckPropertyTarget>(x => x.Age);
            theStep = new Step("grammar");
            context = new TestContext();

            beforeEach();

            then();
        }
コード例 #29
0
        public void calls_the_action_upon_execute()
        {
            var address = new Address();
            var grammar = new DoGrammar((s, c) => c.CurrentObject = address);

            var context = new TestContext();
            grammar.Execute(new Step(), context);

            context.CurrentObject.ShouldBeTheSameAs(address);
        }
コード例 #30
0
        public void SetUp()
        {
            var context = new TestContext(x => { x.AddFixture<FixtureWithHiddenGrammarsFixture>(); });

            var observer = MockRepository.GenerateMock<IFixtureObserver>();
            var builder = new LibraryBuilder(observer, new CompositeFilter<Type>());
            builder.Build(context);

            library = builder.Library;
        }
コード例 #31
0
ファイル: SimpleTests.cs プロジェクト: tocsoft/Linq2OData
        public void GetList()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.ToList();

            Assert.That(ctx.AllRequests, Has.Count.EqualTo(1));
            Assert.That(ctx.LastRequest.QueryParts, Has.Count.EqualTo(0));
            Assert.AreEqual(typeof(Models.TestObject), ctx.LastRequest.Type);
        }
コード例 #32
0
ファイル: TphTest.cs プロジェクト: kjbartel/efmappingapi
        public void Contract_ContractFixed()
        {
            using (var ctx = new TestContext())
            {
                var tableMapping = ctx.Db<ContractFixed>();

                var columns = tableMapping.Properties;
                Assert.AreEqual(21, columns.Length);
            }
        }
コード例 #33
0
        public void Leadership_Create_A_Multiple_Choice_Item_With_One_Column_Layout()
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsLeadership();

                TestContext.WriteLine("\n--- Create a multiple choice item ---");
                workflows.AssessWorkflows.CreateItemWorkflows
                .NavigateToEditTestItemChooseNewItemPage()
                .EditTestItemCreateNewItemSelectMultipleChoice();

                //set up data for EditTestItem.aspx
                EditPageData editPageData = workflows.AssessWorkflows.EditTestItemCreateNewItemPage.InitData();
                editPageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.MultipleChoiceItemResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPageData.ItemTypeData.Name      = "OriginalAutomationMCItemWithOneColumnLayoutName";
                editPageData.ItemTypeData.Keyword   = "OriginalAutomationMultipleChoiceItemKeyword";
                editPageData.ItemTypeData.Publisher = "SNAutomationTeam";
                editPageData.QuestionAnswerData.AnswerChoiceLayoutOption = MultipleChoiceLayout.OneColumn;
                editPageData.StandardPickerData = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Data = editPageData;

                /* Open response only
                 *
                 * workflows.AssessWorkflows.CreateItemWorkflows
                 *  .EditTestItemCreateNewItemPageInputFormFields()
                 *  ;
                 *
                 * //16.3, EnableSpecialCharacterPalette is no longer check as default. Need to check on this as tc 80866
                 * //will fail if this doesn't
                 * if (workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Form.ItemTypeForm.GetType() == typeof(ItemTypeOpenResponseForm))
                 * {
                 *  ((ItemTypeOpenResponseForm)workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Form.ItemTypeForm).CheckEnableSpecialCharacterPalette();
                 * }
                 */

                workflows.AssessWorkflows.CreateItemWorkflows
                .EditTestItemCreateNewItemPageInputAndSubmitForm()
                .EditItemAvailabilityShareWithEveryone()
                .EditItemAvailabilityPageSubmitForm();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
コード例 #34
0
        public void SetUp()
        {
            grammar1 = new ConfigureObjectGrammar<ConfiguredObject, int>("age", (o, age) => o.Age = age);
            grammar2 = new ConfigureObjectGrammar<ConfiguredObject, string>("name", (o, name) => o.Name = name);
            grammar2.DefaultValue = "Han Solo";

            context = new TestContext();
            target = new ConfiguredObject();

            context.CurrentObject = target;
        }
コード例 #35
0
ファイル: SimpleTests.cs プロジェクト: tocsoft/Linq2OData
        public void StringIsNull()
        {
            var ctx = new TestContext<Models.TestObject>();

            ctx.Queryable.Where(x => x.stringProperty == null).ToList();

            Assert.That(ctx.AllRequests, Has.Count.EqualTo(1));
            Assert.That(ctx.LastRequest.QueryParts, Has.Count.EqualTo(1));

            Assert.AreEqual("stringProperty eq null", ctx.LastRequest.Parsed.Filter);
        }
コード例 #36
0
ファイル: TestBase.cs プロジェクト: ulanbekt/ProtoTest.Golem
 private void CreateReportDirectory()
 {
     lock (locker)
     {
         DeleteOldReports();
         Directory.CreateDirectory(Config.settings.reportSettings.reportPath);
         var path = $"{Config.settings.reportSettings.reportPath}\\{Common.GetCurrentTestName()}.html";
         TestContext.WriteLine(path);
         Debug.WriteLine(path);
     }
 }
        public void Endpoint_should_start()
        {
            var context = new TestContext();

            Scenario.Define(context)
                .WithEndpoint<EndpointWithFlakyTimeoutPersister>()
                .Done(c => c.EndpointsStarted)
                .Run();

            Assert.IsTrue(context.EndpointsStarted);
        }
コード例 #38
0
ファイル: BaseTest.cs プロジェクト: Magenic/MAQS
 /// <summary>
 /// Attach an associated file to the text context
 /// </summary>
 private void AttachAssociatedFile(string path)
 {
     // You can only attach files to VS Unit tests so check that first
     if (this.IsVSTest())
     {
         this.TestContext.AddResultFile(path);
     }
     else
     {
         NUnitTestContext.AddTestAttachment(path);
     }
 }
コード例 #39
0
 public void SignInAsStateSuperAdminTest()
 {
     try
     {
         this.SchoolNet().LoadWebPage();
         Workflows workflows = new Workflows();
         workflows.SignInOutWorkflows.SignInAsStateSuperAdmin();
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
        public void SetRowListsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, false);

                int    expectedNumber = 0;
                int    actualNumber   = 0;
                string expected       = null;
                string actual         = null;

                ProfileHomeInProgressTestsGrid.SetColumnLists();
                ProfileHomeInProgressTestsGrid.SetRowLists();

                expectedNumber = 6;
                actualNumber   = ProfileHomeInProgressTestsGrid.GetRowList().Count();
                Assert.AreEqual(expectedNumber, actualNumber, "Assess Dashboard In-Progress Tests Grid does not have the correct number of Rows.");

                expected = "Automated Test 1";
                actual   = ((ProfileHomeInProgressTestsRow)ProfileHomeInProgressTestsGrid.GetRowFromList(1)).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the First Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 2";
                actual   = ((ProfileHomeInProgressTestsRow)ProfileHomeInProgressTestsGrid.GetRowFromList(2)).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Second Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 3";
                actual   = ((ProfileHomeInProgressTestsRow)ProfileHomeInProgressTestsGrid.GetRowFromList(3)).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Third Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 4";
                actual   = ((ProfileHomeInProgressTestsRow)ProfileHomeInProgressTestsGrid.GetRowFromList(4)).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Fourth Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 5";
                actual   = ((ProfileHomeInProgressTestsRow)ProfileHomeInProgressTestsGrid.GetRowFromList(5)).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Fifth Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #41
0
 public void testInputAndSubmitFormAndVerifyErrors()
 {
     try
     {
         AuthenticationTest test = new AuthenticationTest();
         test.testInputAndSubmitFormAndVerifyErrors(this.SchoolNet());
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
         new DriverCommands().GetScreenshotAndPageSource();
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
コード例 #42
0
 public void Leadership_Create_2_Matching_Items()
 {
     try
     {
         for (int i = 0; i < 2; i++)
         {
             Leadership_Create_A_Matching_Item();
         }
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
         new DriverCommands().GetScreenshotAndPageSource();
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
コード例 #43
0
 public void Leadership_Create_5_True_False_Items_With_Correct_Answer_Set_To_True()
 {
     try
     {
         for (int i = 0; i < 5; i++)
         {
             Leadership_Create_A_True_False_Item_With_Correct_Answer_Set_To_True();
         }
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
         new DriverCommands().GetScreenshotAndPageSource();
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
コード例 #44
0
ファイル: BenchmarksTests.cs プロジェクト: SwicaseJia/EasyBus
        public async Task ManualQuery()
        {
            var token = new CancellationTokenSource();
            var query = new BoolQuery();
            var count = 0;

            token.Token.Register(() => TestContext.WriteLine($"Query handled {count} per 10 sec"));
            token.CancelAfter(TimeSpan.FromSeconds(10));

            while (!token.IsCancellationRequested)
            {
                await _queryBus.QueryAsync(query);

                count++;
            }
        }
コード例 #45
0
 public void Leadership_Create_2_Multiple_Choice_Items_With_Two_Columns_Down_Then_Across_Layout()
 {
     try
     {
         for (int i = 0; i < 2; i++)
         {
             Leadership_Create_A_Multiple_Choice_Item_With_Two_Columns_Down_Then_Across_Layout();
         }
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
         new DriverCommands().GetScreenshotAndPageSource();
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
        public void GetDummyElementsDataRowsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                int    expectedNumber = 0;
                int    actualNumber   = 0;
                string expected       = null;
                string actual         = null;

                expectedNumber = 5;
                actualNumber   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows().Count();
                Assert.AreEqual(expectedNumber, actualNumber, "Assess Dashboard In-Progress Tests Grid Dummy Data Rows List does not have the correct number of Data Rows.");

                expected = "Automated Test 1";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows()[0].Text;
                Assert.AreEqual(expected, actual, "First Column Data in the First Data Row of the Assess Dashboard In-Progress Tests Grid Dummy Data Rows List is incorrect");

                expected = "Automated Test 2";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows()[1].Text;
                Assert.AreEqual(expected, actual, "First Column Data in the Second Data Row of the Assess Dashboard In-Progress Tests Grid Dummy Data Rows List is incorrect");

                expected = "Automated Test 3";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows()[2].Text;
                Assert.AreEqual(expected, actual, "First Column Data in the Third Data Row of the Assess Dashboard In-Progress Tests Grid Dummy Data Rows List is incorrect");

                expected = "Automated Test 4";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows()[3].Text;
                Assert.AreEqual(expected, actual, "First Column Data in the Fourth Data Row of the Assess Dashboard In-Progress Tests Grid Dummy Data Rows List is incorrect");

                expected = "Automated Test 5";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsDataRows()[4].Text;
                Assert.AreEqual(expected, actual, "First Column Data in the Fifth Data Row of the Assess Dashboard In-Progress Tests Grid Dummy Data Rows List is incorrect");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #47
0
        public void Leadership_Create_A_Matching_Item()
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsLeadership();

                TestContext.WriteLine("\n--- Create a matching item ---");
                workflows.AssessWorkflows.CreateItemWorkflows
                .NavigateToEditTestItemChooseNewItemPage()
                .EditTestItemCreateNewItemSelectMatching();

                //set up data for EditTestItem.aspx
                EditPageData editPageData = workflows.AssessWorkflows.EditTestItemCreateNewItemPage.InitData();
                editPageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.MatchingItemResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPageData.ItemTypeData.Name      = "OriginalAutomationMatchingItemName";
                editPageData.ItemTypeData.Keyword   = "OriginalAutomationMatchingItemKeyword";
                editPageData.ItemTypeData.Publisher = "SNAutomationTeam";
                editPageData.QuestionAnswerData.QuestionAnswerPair.Add("carrot", "orange");
                editPageData.QuestionAnswerData.QuestionAnswerPair.Add("eggplant", "purple");
                editPageData.QuestionAnswerData.CorrectAnswerPair.Add("carrot", "orange");
                editPageData.QuestionAnswerData.CorrectAnswerPair.Add("eggplant", "purple");
                editPageData.QuestionAnswerData.StudentAnswerPair.Add("carrot", "orange");
                editPageData.QuestionAnswerData.StudentAnswerPair.Add("eggplant", "purple");
                editPageData.QuestionAnswerData.PointValuePair.Add("carrot", "5");
                editPageData.QuestionAnswerData.PointValuePair.Add("eggplant", "5");
                editPageData.StandardPickerData = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Data = editPageData;

                workflows.AssessWorkflows.CreateItemWorkflows
                .EditTestItemCreateNewItemPageInputAndSubmitForm()
                .EditItemAvailabilityShareWithEveryone()
                .EditItemAvailabilityPageSubmitForm();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
        public void SetColumnListsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, false);

                int    expectedNumber = 0;
                int    actualNumber   = 0;
                string expected       = null;
                string actual         = null;

                ProfileHomeInProgressTestsGrid.SetColumnLists();

                expectedNumber = 4;
                actualNumber   = ProfileHomeInProgressTestsGrid.GetColumnList().Count();
                Assert.AreEqual(expectedNumber, actualNumber, "Assess Dashboard In-Progress Tests Grid does not have the correct number of columns.");

                expected = "Test Name";
                actual   = ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name;
                Assert.AreEqual(expected, actual, "First Column Name in the Assess Dashboard In-Progress Tests Grid is not as expected.");

                expected = "End Date";
                actual   = ProfileHomeInProgressTestsGrid.GetColumnFromList(1).Name;
                Assert.AreEqual(expected, actual, "Second Column Name in the Assess Dashboard In-Progress Tests Grid is not as expected.");

                expected = "Scores Due Date";
                actual   = ProfileHomeInProgressTestsGrid.GetColumnFromList(2).Name;
                Assert.AreEqual(expected, actual, "Third Column Name in the Assess Dashboard In-Progress Tests Grid is not as expected.");

                expected = "Collection Status";
                actual   = ProfileHomeInProgressTestsGrid.GetColumnFromList(3).Name;
                Assert.AreEqual(expected, actual, "Fourth Column Name in the Assess Dashboard In-Progress Tests Grid is not as expected.");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
        public void GetDummyElementsColumnsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                int    expectedNumber = 0;
                int    actualNumber   = 0;
                string expected       = null;
                string actual         = null;

                expectedNumber = 4;
                actualNumber   = ProfileHomeInProgressTestsGrid.GetDummyElementsColumns().Count();
                Assert.AreEqual(expectedNumber, actualNumber, "Assess Dashboard In-Progress Tests Grid Dummy Column List does not have the correct number of columns.");

                expected = "Test Name";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsColumns()[0].Text;
                Assert.AreEqual(expected, actual, "Incorrect Column Name for the first column in the Assess Dashboard In-Progress Tests Grid Dummy Column List.");

                expected = "End Date";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsColumns()[1].Text;
                Assert.AreEqual(expected, actual, "Incorrect Column Name for the second column in the Assess Dashboard In-Progress Tests Grid Dummy Column List.");

                expected = "Scores Due Date";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsColumns()[2].Text;
                Assert.AreEqual(expected, actual, "Incorrect Column Name for the third column in the Assess Dashboard In-Progress Tests Grid Dummy Column List.");

                expected = "Collection Status";
                actual   = ProfileHomeInProgressTestsGrid.GetDummyElementsColumns()[3].Text;
                Assert.AreEqual(expected, actual, "Incorrect Column Name for the fourth column in the Assess Dashboard In-Progress Tests Grid Dummy Column List.");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #50
0
        private string TakeScreenshot(string screenshotName)
        {
            int attempt = 0;

            while (attempt < 5)
            {
                attempt++;
                IntegrationTestBase.Log($"Saving error screenshot: {screenshotName} for test run {TestRunTimestamp}");
                string path = CreatePngPath(screenshotName, this.GetType().Name);
                IntegrationTestBase.Log($"{path}");
                try
                {
                    Screenshot screen = this.Screenshooter.GetScreenshot();
                    screen.SaveAsFile(path, ScreenshotImageFormat.Png);
                    TestContext.AddTestAttachment(path);
                    return(path);
                }
                catch (UnhandledAlertException alertException)
                {
                    IntegrationTestBase.Log($"Attempt {attempt} - Unexpected alert {screenshotName} for test run {TestRunTimestamp}.\r\n{alertException}");

                    IAlert unexpectedAlert = this.Driver.SwitchTo().Alert();
                    IntegrationTestBase.Log($"Attempt {attempt} - Alert text: [{unexpectedAlert?.Text}]");
                    unexpectedAlert?.Dismiss();
                    try
                    {
                        Screenshot screen = this.Screenshooter.GetScreenshot();
                        screen.SaveAsFile(path, ScreenshotImageFormat.Png);
                    }
                    catch (Exception screenshotError)
                    {
                        IntegrationTestBase.Log($"Attempt {attempt} - Error while saving screenshot after dismissing alert: {screenshotError}");
                    }
                }
                catch (Exception screenshotError)
                {
                    IntegrationTestBase.Log($"Attempt {attempt} - Error while saving screenshot: {screenshotError}");
                }
            }

            return("Failed to take screenshot");
        }
        public void GetDummyElementsPaginationRowsTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                Assert.IsNull(ProfileHomeInProgressTestsGrid.GetDummyElementsPaginationRows(), "Assess Dashboard In-Progress Tests Grid Dummy Pagination Rows Count is not zero.");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #52
0
        public void DistrictAdmin_Create_MultipleChoice_With_Publisher()
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsDistrictAdmin();

                TestContext.WriteLine("\n--- Create a multiple choice item ---");
                workflows.AssessWorkflows.CreateItemWorkflows
                .NavigateToEditTestItemChooseNewItemPage()
                .EditTestItemCreateNewItemSelectMultipleChoice()
                ;

                //set up data for EditTestItem.aspx
                EditPageData editPageData = workflows.AssessWorkflows.EditTestItemCreateNewItemPage.InitData();
                editPageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.MultipleChoiceItemResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPageData.ItemTypeData.Name      = "OriginalAutomationItemMC";
                editPageData.ItemTypeData.Keyword   = "OriginalAutomationItemMC_Keyword";
                editPageData.ItemTypeData.Publisher = "OriginalAutomationItemMC_Publisher";
                editPageData.StandardPickerData     = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Data = editPageData;

                workflows.AssessWorkflows.CreateItemWorkflows
                .EditTestItemCreateNewItemPageInputAndSubmitForm()
                .EditItemAvailabilityShareWithEveryone()
                .EditItemAvailabilityPageSubmitForm()
                ;

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
        public void GetsFirstRowContainingTextToFindFromListTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                string expected = null;
                string actual   = null;

                expected = "Automated Test 1";
                actual   = ProfileHomeInProgressTestsGrid.GetsFirstRowContainingTextToFindFromList(ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name, expected).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the First Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 2";
                actual   = ProfileHomeInProgressTestsGrid.GetsFirstRowContainingTextToFindFromList(ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name, expected).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Second Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 3";
                actual   = ProfileHomeInProgressTestsGrid.GetsFirstRowContainingTextToFindFromList(ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name, expected).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Third Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 4";
                actual   = ProfileHomeInProgressTestsGrid.GetsFirstRowContainingTextToFindFromList(ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name, expected).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Fourth Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");

                expected = "Automated Test 5";
                actual   = ProfileHomeInProgressTestsGrid.GetsFirstRowContainingTextToFindFromList(ProfileHomeInProgressTestsGrid.GetColumnFromList(0).Name, expected).GetTestName();
                Assert.AreEqual(expected, actual, "First Column Data in the Fifth Data Row of the Assess Dashboard In-Progress Tests Grid is incorrect");
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
        public void GetGridRowTypeTest()
        {
            this.SchoolNet().LoadWebPage();

            try
            {
                string gridCssSelector = "ProfileControl_InProgressTestResults_ctl00_gridResults";
                ProfileHomeInProgressTestsGrid ProfileHomeInProgressTestsGrid = new ProfileHomeInProgressTestsGrid(gridCssSelector, true);

                GridRowType expected;
                GridRowType actual;

                List <SNGridRow> ProfileHomeInProgressTestsGridRowList = ProfileHomeInProgressTestsGrid.GetRowList();

                foreach (SNGridRow ProfileHomeInProgressTestsGridRow in ProfileHomeInProgressTestsGridRowList)
                {
                    if (ProfileHomeInProgressTestsGridRow.Index == 0)
                    {
                        expected = GridRowType.Header;
                        actual   = ProfileHomeInProgressTestsGrid.GetGridRowType(ProfileHomeInProgressTestsGridRow.Index);
                        Assert.AreEqual(expected, actual, "First Row of the Assess Dashboard In-Progress Tests Grid is not a Header Row");
                    }

                    else
                    {
                        expected = GridRowType.Data;
                        actual   = ProfileHomeInProgressTestsGrid.GetGridRowType(ProfileHomeInProgressTestsGridRow.Index);
                        Assert.AreEqual(expected, actual,
                                        string.Format("Row  with Index '{0}' of the Assess Dashboard In-Progress Tests Grid is not a Data Row", ProfileHomeInProgressTestsGridRow.Index.ToString()));
                    }
                }
            }

            catch (Exception e)
            {
                TestContext.WriteLine("" + e.GetBaseException());
                throw new Exception("\nMessage:\n" + e.Message
                                    + "\nInnerException:\n" + e.InnerException
                                    + "\nStackTrace:\n" + e.StackTrace + "\n", e);
            }
        }
コード例 #55
0
        public void Leadership_Create_A_Multiple_Choice_Item_With_Two_Columns_Down_Then_Across_Layout()
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsLeadership();

                TestContext.WriteLine("\n--- Create a multiple choice item ---");
                workflows.AssessWorkflows.CreateItemWorkflows
                .NavigateToEditTestItemChooseNewItemPage()
                .EditTestItemCreateNewItemSelectMultipleChoice();

                //set up data for EditTestItem.aspx
                EditPageData editPageData = workflows.AssessWorkflows.EditTestItemCreateNewItemPage.InitData();
                editPageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.MultipleChoiceItemResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPageData.ItemTypeData.Name      = "OriginalAutomationMCItemWithTwoColumnsDownThenAcrossLayoutName";
                editPageData.ItemTypeData.Keyword   = "OriginalAutomationMultipleChoiceItemKeyword";
                editPageData.ItemTypeData.Publisher = "SNAutomationTeam";
                editPageData.QuestionAnswerData.AnswerChoiceLayoutOption = MultipleChoiceLayout.TwoColumnsDownThenAcross;
                editPageData.StandardPickerData = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Data = editPageData;

                workflows.AssessWorkflows.CreateItemWorkflows
                .EditTestItemCreateNewItemPageInputAndSubmitForm()
                .EditItemAvailabilityShareWithEveryone()
                .EditItemAvailabilityPageSubmitForm();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
コード例 #56
0
        public void Leadership_Create_A_True_False_Item_With_Correct_Answer_Set_To_True()
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsLeadership();

                TestContext.WriteLine("\n--- Create a true/false item ---");
                workflows.AssessWorkflows.CreateItemWorkflows
                .NavigateToEditTestItemChooseNewItemPage()
                .EditTestItemCreateNewItemSelectTrueFalse();

                //set up data for EditTestItem.aspx
                EditPageData editPageData = workflows.AssessWorkflows.EditTestItemCreateNewItemPage.InitData();
                editPageData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.TrueFalseItemResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                editPageData.ItemTypeData.Name      = "OriginalAutomationTFItemWithCorrectResponseTrueName";
                editPageData.ItemTypeData.Keyword   = "OriginalAutomationTrueFalseItemKeyword";
                editPageData.ItemTypeData.Publisher = "SNAutomationTeam";
                editPageData.StandardPickerData     = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                workflows.AssessWorkflows.EditTestItemCreateNewItemPage.Data = editPageData;

                workflows.AssessWorkflows.CreateItemWorkflows
                .EditTestItemCreateNewItemPageInputAndSubmitForm()
                .EditItemAvailabilityShareWithEveryone()
                .EditItemAvailabilityPageSubmitForm();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
コード例 #57
0
 public void testAuthenticationInputAndSubmitForm()
 {
     try
     {
         this.SchoolNet().LoadWebPage();
         AuthenticationPage authenticationPage = new AuthenticationPage();
         AuthenticationData authenticationData = authenticationPage.InitData();
         authenticationData.GetTestDataFromResxResource("UITests.Data.Login.AuthenticationResource",
                                                        "valid_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
         //authenticationData.DistrictName = "National";
         //authenticationData.Username = "******";
         //authenticationData.Password = "******";
         authenticationPage.Data = authenticationData;
         HomePage homePage = (HomePage)authenticationPage.Form.InputAndSubmitForm();
     }
     catch (Exception e)
     {
         TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
         new DriverCommands().GetScreenshotAndPageSource();
         throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
     }
 }
        public void Leadership_Create_A_Manual_Test_With_1_Item_Search(CreateTestAndItemCentralData createTestAndItemCentralData)
        {
            try
            {
                this.SchoolNet().LoadWebPage();
                Workflows workflows = new Workflows();
                workflows.SignInAsLeadership();

                //Create manual test
                TestContext.WriteLine("\n --- Create manual test ---");
                workflows.AssessWorkflows.CreateManualTestWorkflows
                .NavigateToCreateManualTestPage();

                //set up data for CreateTest.aspx
                CreateTestManualData createTestManualData = workflows.AssessWorkflows.CreateTestManualPage.InitData();
                createTestManualData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.TestCreateEdit.CreateTestResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                createTestManualData.TestId        = createTestAndItemCentralData.TestID;
                createTestManualData.TestCategory  = "District Benchmark";
                createTestManualData.NumberOfItems = createTestAndItemCentralData.NumberOfItems;
                workflows.AssessWorkflows.CreateTestManualPage.Data = createTestManualData;

                //create a manual test and look up an existing item
                workflows.AssessWorkflows.CreateManualTestWorkflows
                .SetNumberOfItems(createTestManualData.NumberOfItems)
                .NavigateToChooseNewItemPage()
                .ChooseNewItemLookupInItemCentral();

                //select item central advanced search
                workflows.AssessWorkflows.ItemCentralWorkflows
                .SelectAdvanceSearch();

                //set up data for ItemCentral.aspx
                ItemCentralData itemCentralData = workflows.AssessWorkflows.ItemCentralPage.InitData();
                itemCentralData.GetTestDataFromResxResource(
                    "UITests.Data.Assess.ItemCreateEdit.ItemPropertiesResource",
                    "UITests.Data.Assess.ItemCreateEdit.ItemStatisticsResource",
                    "UITests.Data.Assess.Passage.PassageResource",
                    "UITests.Data.Assess.ItemCentral.ItemCentralResource",
                    "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0);
                itemCentralData.ItemTypeData.Name      = createTestAndItemCentralData.ItemName;
                itemCentralData.ItemTypeData.Keyword   = createTestAndItemCentralData.ItemKeyword;
                itemCentralData.ItemTypeData.Publisher = "SNAutomationTeam";
                itemCentralData.ItemTypeData.ItemType  = createTestAndItemCentralData.ItemType;
                itemCentralData.StandardPickerData     = new StandardPickerDataStructures().GetDefaultStandardPickerData();
                itemCentralData.ItemStatisticsData     = null;
                itemCentralData.NumberOfItemsToBeAddedToTestFromSearchResults = createTestManualData.NumberOfItems;
                workflows.AssessWorkflows.ItemCentralPage.Data = itemCentralData;

                //input the item properties, and search for items
                workflows.AssessWorkflows.ItemCentralWorkflows
                .ItemCentralPageInputAndSubmitForm_ItemProperties()
                .ItemCentralPageSubmitForm();

                //check each item in the item central search results list
                for (int searchResultToSelectIndex = 0; searchResultToSelectIndex < createTestAndItemCentralData.NumberOfItems; searchResultToSelectIndex++)
                {
                    workflows.AssessWorkflows.ItemCentralWorkflows
                    .ItemCentralSearchResultsPageSelectItemInResultsListByIndex(searchResultToSelectIndex);
                }
                //add items to test
                workflows.AssessWorkflows.ItemCentralWorkflows
                .ItemCentralSearchResultsPageAddItemsToViewTestDetailsPage();

                //verify the number of items added appear in the view test details results list
                if (this.SchoolNet().Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                {
                    itemCentralData.NumberOfItemsToBeAddedToTestFromSearchResults = workflows.AssessWorkflows.ViewTestDetailsPage.Form.GetResultsList().Count;
                }
                Assert.AreEqual(itemCentralData.NumberOfItemsToBeAddedToTestFromSearchResults,
                                workflows.AssessWorkflows.ViewTestDetailsPage.Form.GetResultsList().Count,
                                "Required number of Items have not been added to the Test");

                workflows.AssessWorkflows.ViewTestDetailsWorkflows
                .ViewTestDetailsPageMakePublic()
                .ViewTestDetailsPageReadyToSchedule();

                workflows.SignOut();
            }
            catch (Exception e)
            {
                TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace);
                new DriverCommands().GetScreenshotAndPageSource();
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
コード例 #59
0
 public AuthenticationTest()
 {
     TestContext.WriteLine("AuthenticationTest");
 }
コード例 #60
0
 public CreatePassagesTest()
 {
     TestContext.WriteLine("CreatePassagesTest");
 }