public async Task ReturnsFalseForSourceThatDoesntExistsInDataDir() { var data = new byte[] { 3, 4, 5 }; var expectedFileName = Path.Combine(_DataDir, "5.left"); File.Delete(expectedFileName); var storage = new DiskStorage(_Options); var(_, exists) = await storage.LoadSourceAsync(5, SourceSide.Left); exists.Should().BeFalse(); }
public async Task LoadsSourceFromDataDir(int diffId, SourceSide side) { var data = new byte[] { 3, 4, 5 }; var expectedFileName = Path.Combine(_DataDir, string.Concat( diffId.ToString(), ".", side.ToString().ToLowerInvariant())); File.WriteAllBytes(expectedFileName, data); try { var storage = new DiskStorage(_Options); var(source, exists) = await storage.LoadSourceAsync(diffId, side); source.SourceSide.Should().Be(side); source.Data.Should().Equal(data); exists.Should().BeTrue(); } finally { File.Delete(expectedFileName); } }