public void CreatePersons_TestDuplicateBehavior() { int reccount = 0; // //Arrange Person _p = frb.ClonePerson(); // //Act try { // Using Service Create to test behavior when same object is created // 3 times. Expecting 3 different records. frb.ToServPerson().Create(_p, "UnitTest"); frb.ToServPerson().Create(_p, "UnitTest"); frb.ToServPerson().Create(_p, "UnitTest"); reccount = frb.ToServPerson().GetAll().Count(n => n.firstname1 == _p.firstname1); } catch (DbEntityValidationException ex) { Assert.Fail(string.Format("Validation exception for field {0} caught: {1}", ex.EntityValidationErrors.First().ValidationErrors.First().PropertyName, ex.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage)); } catch (Exception ex) { Assert.Fail(string.Format("Unexpected exception of type {0} caught: {1}", ex.GetType(), ex.Message)); } // //Assert Assert.IsNotNull(_p.ID); Assert.IsTrue(reccount == 3, "Expected record count of 3, received {0}", reccount); }
public void SeActivity_test_pagination() { // Arrange FluentRecordBase SeDB = new FluentRecordBase(); int count = SeDB.ToServActivity().GetAll().Count(); if (count < 20) { Person _person = (Person)Records.person.Clone(); SeDB.ToServPerson().Create(_person, "ME"); } // Act ui.WaitThenClickElement(By.Id("menulinkactivity")); var recordID = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid"); ui.WaitThenClickElement(By.CssSelector("#activityTable_next.paginate_enabled_next")); Thread.Sleep(1000); // Prevent race condition var recordIDPage = ui.WaitForElement(By.XPath("//table[@id='activityTable']/tbody/tr")).GetAttribute("recordid"); // Assert Assert.AreNotEqual(recordID, recordIDPage, "Pagination for Activities List appears to not be working"); }