public Datastores GetDatastores() { var dataStores = new Datastores(); var xmlDatastoreConfiguration = new XmlDatastoreConfiguration(null, null); var xmlDatastore = new XmlDatastore(xmlDatastoreConfiguration); dataStores.AddDatastore(xmlDatastore); var inMemoryDatasToreConfiguration = new InMemoryDatastoreConfiguration(); var inMemoryDatastore = new InMemoryDatastore(); dataStores.AddDatastore(inMemoryDatastore); dataStores.SelectDatastore(inMemoryDatastore); return dataStores; }
public Main() { // const string xmlFileName = @"PassFruit.xml"; var xmlFilePath = Path.GetTempFileName(); File.Delete(xmlFilePath); var fileExists = File.Exists(xmlFilePath); var xmlDatastoreConfiguration = new XmlDatastoreConfiguration( () => fileExists ? XDocument.Load(xmlFilePath) : new XDocument(), xDocument => xDocument.Save(xmlFilePath) ); _dataStore = new XmlDatastore(xmlDatastoreConfiguration); if (!fileExists) { var fakeDataGenerator = new FakeDataGenerator(); fakeDataGenerator.GenerateFakeData(_dataStore); } }