public virtual void TestInitialise() { _context = new TestVotingContext(); // Open, Anonymous, No Choice Adding, Shown Results _defaultPoll = new Poll() { UUID = PollGuid, ManageId = PollManageGuid, PollType = PollType.Basic, Name = "Test Poll", LastUpdatedUtc = DateTime.UtcNow, CreatedDateUtc = DateTime.UtcNow, Choices = new List <Choice>(), InviteOnly = false, NamedVoting = false, ChoiceAdding = false }; _context.Polls.Add(_defaultPoll); _context.SaveChanges(); _driver = new NgWebDriver(new ChromeDriver(ChromeDriverDir)); _driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10)); _driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10)); }
public void ManagePollType_Save_WarnsUser() { Choice pollChoice = new Choice() { PollChoiceNumber = 1, Name = "Choice" }; _defaultPoll.Choices.Add(pollChoice); Ballot pollBallot = new Ballot { ManageGuid = Guid.NewGuid(), TokenGuid = Guid.NewGuid(), Votes = new List <Vote>(), HasVoted = true }; Vote pollVote = new Vote() { Poll = _defaultPoll, Ballot = pollBallot, Choice = pollChoice }; pollBallot.Votes.Add(pollVote); _defaultPoll.Ballots.Add(pollBallot); _context.SaveChanges(); _driver.Navigate().GoToUrl(PollUrl); IWebElement multiVoteButton = _driver.FindElement(By.Id("multi-vote-button")); multiVoteButton.Click(); IWebElement saveButton = _driver.FindElement(By.Id("save-button")); saveButton.Click(); Assert.AreEqual(PollUrl, _driver.Url); IWebElement dialogContent = _driver.FindElement(By.ClassName("dialog-content")); Assert.IsTrue(dialogContent.IsVisible()); }
public virtual void TestInitialise() { _context = new TestVotingContext(); // Open, Anonymous, No Choice Adding, Shown Results _defaultPoll = new Poll() { UUID = PollGuid, ManageId = PollManageGuid, PollType = PollType.Basic, Name = "Test Poll", LastUpdatedUtc = DateTime.UtcNow, CreatedDateUtc = DateTime.UtcNow, Choices = new List <Choice>(), InviteOnly = false, NamedVoting = false, ChoiceAdding = false, MaxPerVote = 3, MaxPoints = 4, Ballots = new List <Ballot>() }; Choice testChoice = new Choice() { Name = "Test", PollChoiceNumber = 1 }; _defaultPoll.Choices.Add(testChoice); Ballot ballot1 = new Ballot() { TokenGuid = Guid.NewGuid(), ManageGuid = Guid.NewGuid(), VoterName = "Voter 1", Votes = new List <Vote>() }; Ballot ballot2 = new Ballot() { TokenGuid = Guid.NewGuid(), ManageGuid = Guid.NewGuid(), VoterName = "Voter 2", Votes = new List <Vote>() }; ballot1.Votes.Add(new Vote() { Choice = testChoice, Ballot = ballot1, VoteValue = 1 }); ballot2.Votes.Add(new Vote() { Choice = testChoice, Ballot = ballot2, VoteValue = 1 }); _defaultPoll.Ballots.Add(ballot1); _defaultPoll.Ballots.Add(ballot2); _context.Polls.Add(_defaultPoll); _context.SaveChanges(); _driver = new NgWebDriver(new ChromeDriver(ChromeDriverDir)); _driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10)); _driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10)); }