Implemented async saving and loading

This commit is contained in:
Ben
2015-07-25 19:02:42 +01:00
parent e54730d693
commit 32b0a0199f
22 changed files with 245 additions and 119 deletions

View File

@@ -18,7 +18,7 @@ namespace Filtration.Tests.Repositories
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
mockPersistenceService.Setup(p => p.LoadItemFilterScript(testInputPath)).Verifiable();
mockPersistenceService.Setup(p => p.LoadItemFilterScriptAsync(testInputPath)).Verifiable();
var mockItemFilterScriptViewModel = new Mock<IItemFilterScriptViewModel>();
@@ -28,7 +28,7 @@ namespace Filtration.Tests.Repositories
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
// Act
var result = repository.LoadScriptFromFile(testInputPath);
var result = repository.LoadScriptFromFileAsync(testInputPath);
// Assert
mockPersistenceService.Verify();
@@ -42,7 +42,7 @@ namespace Filtration.Tests.Repositories
var testInputPath = "C:\\TestPath.filter";
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
mockPersistenceService.Setup(p => p.LoadItemFilterScript(testInputPath)).Throws<IOException>();
mockPersistenceService.Setup(p => p.LoadItemFilterScriptAsync(testInputPath)).Throws<IOException>();
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
@@ -51,7 +51,7 @@ namespace Filtration.Tests.Repositories
// Act
// Assert
Assert.Throws<IOException>(() => repository.LoadScriptFromFile(testInputPath));
Assert.Throws<IOException>(() => repository.LoadScriptFromFileAsync(testInputPath));
}
[Test]

View File

@@ -28,7 +28,7 @@ namespace Filtration.Tests.Services
var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object);
// Act
var script = service.LoadItemFilterScript(TestInputPath);
var script = service.LoadItemFilterScriptAsync(TestInputPath);
// Assert
mockFileSystemService.Verify();
@@ -53,7 +53,7 @@ namespace Filtration.Tests.Services
var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object);
// Act
service.SaveItemFilterScript(testScript);
service.SaveItemFilterScriptAsync(testScript);
// Assert
mockFileSystemService.Verify();