public void HandleMinutesDuringV8Migration() { // Arrange var bufferFiles = new TimeRolledBufferFiles(directoryService, "SomeBuffer"); var want = new[] { // "json" extension was used < v8 "SomeBuffer-200112312358.json", "SomeBuffer-200112312359.json", "SomeBuffer-200201010000.json", // "txt" is used from >= v8 "SomeBuffer-200201010000.txt", "SomeBuffer-200201010001.txt", "SomeBuffer-200201010002.txt" }; directoryService.Files = Randomize.Values(want); // Act var got = bufferFiles.Get(); // Assert got.ShouldBe(want); }
public void HaveBookmarkFileName(string bufferBaseFilePath, string want) { // Arrange var bufferFiles = new TimeRolledBufferFiles(directoryService, bufferBaseFilePath); want = want.Replace("{CurrentDirectory}", Environment.CurrentDirectory); want = Path.GetFullPath(want); // Act var got = bufferFiles.BookmarkFileName; // Assert got.ShouldBe(want); }
public void GetOnlyBufferFiles() { // Arrange var bufferFiles = new TimeRolledBufferFiles(directoryService, "SomeBuffer"); var want = new[] { "SomeBuffer-2000.txt", "SomeBuffer-200001.txt", "SomeBuffer-20000102.txt", "SomeBuffer-2000010203.txt", "SomeBuffer-200001020304.txt", }; directoryService.Files = Randomize.Values( want.Concat(new[] { // Wrong extension "SomeBuffer-2000.config", "SomeBuffer-2000.dll", "SomeBuffer-2000.exe", "SomeBuffer-2000.xml", // Wrong file name format "SomeBuffer.txt", "SomeBuffer.json", "XSomeBuffer-2000.txt", "XSomeBuffer-2000.json", "SomeBufferX-2000.txt", "SomeBufferX-2000.json", "SomeBuffer-X2000.txt", "SomeBuffer-X2000.json", "SomeBuffer-2000X.txt", "SomeBuffer-2000X.json", "SomeBuffer-2000.Xtxt", "SomeBuffer-2000.Xjson" })); // Act var got = bufferFiles.Get(); // Assert got.ShouldBe(want); }
public void HandleYears() { // Arrange var bufferFiles = new TimeRolledBufferFiles(directoryService, "SomeBuffer"); var want = new[] { "SomeBuffer-2008.txt", "SomeBuffer-2009.txt", "SomeBuffer-2010.txt", "SomeBuffer-2011.txt" }; directoryService.Files = Randomize.Values(want); // Act var got = bufferFiles.Get(); // Assert got.ShouldBe(want); }
public TimeRolledBufferFilesShould() { directoryService = new Mock <IDirectoryService>(); bufferFiles = new TimeRolledBufferFiles(directoryService.Object, BufferPathFormat); }
public TimeRolledBufferFilesShould() { directoryService = new Mock <IDirectoryService>(); bufferFiles = new TimeRolledBufferFiles(directoryService.Object, "SomeBuffer"); }