public void GetAllElements_EmptyOrNonexistentDirectory_ReturnsEmptyCollection() { WithUniqueTempDirectory(dirInfo => { // Arrange var repository = new FileSystemXmlRepository(dirInfo); // Act var allElements = repository.GetAllElements(); // Assert Assert.Equal(0, allElements.Count); }); }
public void StoreElements_ThenRetrieve_SeesAllElements() { WithUniqueTempDirectory(dirInfo => { // Arrange var repository = new FileSystemXmlRepository(dirInfo); // Act repository.StoreElement(new XElement("element1"), friendlyName: null); repository.StoreElement(new XElement("element2"), friendlyName: null); repository.StoreElement(new XElement("element3"), friendlyName: null); var allElements = repository.GetAllElements(); // Assert var orderedNames = allElements.Select(el => el.Name.LocalName).OrderBy(name => name); Assert.Equal(new[] { "element1", "element2", "element3" }, orderedNames); }); }