public void GetAllEntities_NotRecursive_SameItemsAmount() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); var items = UsersRepository.GetAllEntities(web, false); Assert.AreEqual(items.Length, MockUsers.AllUsers.Length); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetEntitiesByTitle_WithSpecificTitle_RightItem() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); var developer = UsersRepository.GetEntitiesByTitle(web, MockUsers.User1.DisplayName); Assert.IsTrue(developer.All(d => d.DisplayName == MockUsers.User1.DisplayName)); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetEntities_GetByNameUsingNativeSPCaml_OnePerson() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); uint rowLimit = 1; var aspDevelopersWithLimit = UsersRepository.GetByJobTitle(web, "ASP", rowLimit); Assert.IsTrue(aspDevelopersWithLimit.Length <= rowLimit, $"Row limit is {rowLimit}."); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetEntities_QueryWithRowLimit_ReturnsCorrectItemsAmount() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); uint rowLimit = 1; var aspDevelopersWithLimit = UsersRepository.GetByJobTitle(web, "ASP", rowLimit); Assert.IsTrue(aspDevelopersWithLimit.Length <= rowLimit, $"Row limit is {rowLimit}."); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetByAgeWithDisplayName_WithSpecificAge_ReturnsItemsWithDisplayNameOnly() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); var adultDevelopers = UsersRepository.GetByAgeWithDisplayName(web, 23); Assert.AreEqual(2, adultDevelopers.Length); Assert.IsNotNull(adultDevelopers[0].DisplayName); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetAllEntities_Recursive_SameItemsAmount() { Perform(web => { var folderName = "New Employees"; try { UsersRepository.AddRange(web, MockUsers.AllUsers); UsersRepository.Add(web, folderName, MockUsers.User1); var items = UsersRepository.GetAllEntities(web); Assert.AreEqual(items.Length, MockUsers.AllUsers.Length + 1); } finally { UsersRepository.DeleteAll(web); UsersRepository.DeleteFolder(web, folderName); } }); }
public void GetBySeniorityAndJobTitle_WithSpecificSeniorityAndJobKeyWord_ReturnsOneEmployee() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); var aspMiddleDevelopers = UsersRepository.GetBySeniorityAndJobTitle(web, Data.Users.Seniority.Middle, "ASP"); var olga = aspMiddleDevelopers[0]; Assert.AreEqual(1, aspMiddleDevelopers.Length); Assert.AreEqual("Olga M", olga.DisplayName); } finally { UsersRepository.DeleteAll(web); } }); }
public void GetEntities_QueryByJobTitle_EqualAmountAndJobTitles() { Perform(web => { try { UsersRepository.AddRange(web, MockUsers.AllUsers); var aspDevelopers = UsersRepository.GetByJobTitle(web, "ASP"); Assert.AreEqual( MockUsers.AllUsers.Count(d => d.JobTitle.Contains("ASP")), aspDevelopers.Length); Assert.IsTrue(aspDevelopers.ToList().All(d => d.JobTitle.Contains("ASP"))); } finally { UsersRepository.DeleteAll(web); } }); }