public void Delete_EntryInRepo_ShouldDelete_ShouldReturnTrue() { // arrange const string repoDirectory = "Test6/"; Assert.False(Directory.Exists(repoDirectory)); const string repoPath = "Delete_EntryInRepo_ShouldDelete_ShouldReturnTrue.bin"; const string entryPath = "Test_Delete_EntryInRepo_ShouldDelete_ShouldReturnTrue.bin"; var gameState = new ChessGameState(null, true, null, TeamColor.None, PlayerMode.SinglePlayer, 0); var repoSaver = new SaveRepository(repoDirectory, repoPath); repoSaver.Save(entryPath, gameState); var repoDeleter = new SaveRepository(repoDirectory, repoPath); // act bool isInRepo = repoDeleter.Contains(entryPath); bool result = repoDeleter.Delete(entryPath); // assert Assert.True(isInRepo); Assert.True(result); // clear Directory.Delete(repoDirectory, true); }
public void Delete_EntryNotRepo_ShouldDelete_ShouldReturnFalse() { // arrange const string repoDirectory = "Test7/"; Assert.False(Directory.Exists(repoDirectory)); const string repoPath = "Delete_EntryInRepo_ShouldDelete_ShouldReturnTrue.bin"; const string entryPath = "Test_Delete_EntryInRepo_ShouldDelete_ShouldReturnTrue.bin"; var repoDeleter = new SaveRepository(repoDirectory, repoPath); // act bool isInRepo = repoDeleter.Contains(entryPath); bool result = repoDeleter.Delete(entryPath); // assert Assert.False(isInRepo); Assert.False(result); // clear Directory.Delete(repoDirectory, true); }