public void GetAllElements_EmptyOrNonexistentDirectory_ReturnsEmptyCollection() { WithUniqueTempRegKey(regKey => { // Arrange var repository = new RegistryXmlRepository(regKey); // Act var allElements = repository.GetAllElements(); // Assert Assert.Equal(0, allElements.Count); }); }
public void GetAllElements_EmptyOrNonexistentDirectory_ReturnsEmptyCollection() { WithUniqueTempRegKey(regKey => { // Arrange var repository = new RegistryXmlRepository(regKey); // Act var allElements = repository.GetAllElements(); // Assert Assert.Equal(0, allElements.Count); }); }
public void StoreElements_ThenRetrieve_SeesAllElements() { WithUniqueTempRegKey(regKey => { // Arrange var repository = new RegistryXmlRepository(regKey); // 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); }); }
public void StoreElements_ThenRetrieve_SeesAllElements() { WithUniqueTempRegKey(regKey => { // Arrange var repository = new RegistryXmlRepository(regKey); // 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); }); }