public void CreateDatabaseStructure_WithNonExistingNetworkPath_DoesNotThrowException() { // Setup const string fileName = "DoesNotExist.sqlite"; string fullPath = TestHelper.GetScratchPadPath(fileName); string uncPath = TestHelper.ToUncPath(fullPath); // Precondition Assert.IsFalse(File.Exists(fullPath)); try { // Call TestDelegate call = () => StorageSqliteCreator.CreateDatabaseStructure(uncPath); // Assert Assert.DoesNotThrow(call); Assert.IsTrue(File.Exists(fullPath)); } finally { if (File.Exists(fullPath)) { File.Delete(fullPath); } } }
public void CreateDatabaseStructure_InvalidFilePath_ThrowsArgumentException(string invalidPath) { // Call TestDelegate call = () => StorageSqliteCreator.CreateDatabaseStructure(invalidPath); // Assert Assert.Throws <ArgumentException>(call); }
public void CreateDatabaseStructure_ValidExistingFile_ThrowsStorageException() { string tempProjectFile = TestHelper.GetScratchPadPath(nameof(CreateDatabaseStructure_ValidExistingFile_ThrowsStorageException)); using (var disposeHelper = new FileDisposeHelper(tempProjectFile)) { disposeHelper.LockFiles(); // Call TestDelegate call = () => StorageSqliteCreator.CreateDatabaseStructure(tempProjectFile); // Assert var exception = Assert.Throws <ArgumentException>(call); string expectedMessage = $@"File '{tempProjectFile}' already exists."; Assert.AreEqual(expectedMessage, exception.Message); } }