public void CanRecallSavedDataFromDefaultLocation() { //given a storage which uses the default location var storage = new UserDetailsStorage(new FileSystem()); //which has some data saved in it var savedDetails = new UserDetails(); savedDetails.AddSage50DataLocation("c:\\Audition\\Sage50"); storage.Save(savedDetails); //then the details can be loaded correctly var loadedDetails = storage.Load(); CollectionAssert.AreEqual(new[] { "c:\\Audition\\Sage50" }, loadedDetails.Sage50DataLocations); }
public void WhenPathDoesNotExistItIsCreated() { //given a storage pointing at a path which does not exist var directoryWhichDoesNotExist = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var fileOnPathWhichDoesnNotExist = Path.Combine(directoryWhichDoesNotExist, Path.GetRandomFileName()); var storage = new UserDetailsStorage(new FileSystem(), fileOnPathWhichDoesnNotExist); //and some details var userDetails = new UserDetails(); userDetails.AddSage50DataLocation("something"); //when we try to save the details storage.Save(userDetails); //then the collection is saved and can be retrieved successfully var loadedDetails = storage.Load(); CollectionAssert.AreEqual(new[] { "something" }, loadedDetails.Sage50DataLocations); }