public void SetUp() { kernel = new StandardKernel(); tmp = new TempDirectory(); rootDir = new LocalFileSystemDirectory(tmp); using (var writer = rootDir.CreateTextFile("file1")) writer.WriteLine("Contents of file 1"); using (var writer = rootDir.CreateTextFile("file2")) writer.WriteLine("Contents of file 2"); using (var writer = rootDir.CreateTextFile("file3")) writer.WriteLine("Contents of file 3"); sourceSet1 = new SourceSet("test1"); sourceSet1.Add(new SuiteRelativePath("file1")); sourceSet1.Add(new SuiteRelativePath("file2")); sourceSet2 = new SourceSet("test2"); sourceSet2.Add(new SuiteRelativePath("file1")); sourceSet2.Add(new SuiteRelativePath("file3")); kernel.Bind <IFileSystemDirectory>().ToConstant(rootDir).WhenTargetHas <SuiteRootAttribute>(); var factoryMock = new Mock <ISourceSetFingerprintFactory>(); factoryMock.Setup( f => f.CreateSourceSetFingerprint(It.IsAny <IEnumerable <SuiteRelativePath> >(), It.IsAny <Func <string, bool> >(), It.IsAny <bool>())) .Returns <IEnumerable <SuiteRelativePath>, Func <string, bool>, bool>( (files, exclusions, fullDependency) => new SourceSetFingerprint(rootDir, files, exclusions, fullDependency)); fingerprintFactory = factoryMock.Object; }
public void SetUp() { kernel = new StandardKernel(); tmp = new TempDirectory(); rootDir = new LocalFileSystemDirectory(tmp); using (var writer = rootDir.CreateTextFile("file1")) writer.WriteLine("Contents of file 1"); using (var writer = rootDir.CreateTextFile("file2")) writer.WriteLine("Contents of file 2"); using (var writer = rootDir.CreateTextFile("file3")) writer.WriteLine("Contents of file 3"); sourceSet1 = new SourceSet("test1"); sourceSet1.Add(new SuiteRelativePath("file1")); sourceSet1.Add(new SuiteRelativePath("file2")); sourceSet2 = new SourceSet("test2"); sourceSet2.Add(new SuiteRelativePath("file1")); sourceSet2.Add(new SuiteRelativePath("file3")); kernel.Bind<IFileSystemDirectory>().ToConstant(rootDir).WhenTargetHas<SuiteRootAttribute>(); var factoryMock = new Mock<ISourceSetFingerprintFactory>(); factoryMock.Setup( f => f.CreateSourceSetFingerprint(It.IsAny<IEnumerable<SuiteRelativePath>>(), It.IsAny<Func<string, bool>>(), It.IsAny<bool>())) .Returns<IEnumerable<SuiteRelativePath>, Func<string, bool>, bool>( (files, exclusions, fullDependency) => new SourceSetFingerprint(rootDir, files, exclusions, fullDependency)); fingerprintFactory = factoryMock.Object; }
public void CreateTextFileWorks() { using (var tmp = new TempDirectory()) { var dir = new LocalFileSystemDirectory(tmp); using (var writer = dir.CreateTextFile("test.txt")) writer.WriteLine("Hello world"); dir.Files.Should().Contain("test.txt"); File.Exists(Path.Combine(tmp, "test.txt")).Should().BeTrue(); } }
public void CreateTextFileWorks() { using (var tmp = new TempDirectory()) { var dir = new LocalFileSystemDirectory(tmp); using (var writer = dir.CreateTextFile("test.txt")) writer.WriteLine("Hello world"); dir.Files.Should().Contain("test.txt"); File.Exists(Path.Combine(tmp, "test.txt")).Should().BeTrue(); } }
public void GetLastModifiedDateReturnsLastModifiedDateInUTC() { using (var tmp = new TempDirectory()) { var dir = new LocalFileSystemDirectory(tmp); using (var writer = dir.CreateTextFile("test.txt")) writer.WriteLine("Hello world"); var lastWriteTime = File.GetLastWriteTimeUtc(Path.Combine(tmp, "test.txt")); var lastModifiedDate = dir.GetLastModifiedDate("test.txt"); lastModifiedDate.Should().Be(lastWriteTime); } }
public void GetLastModifiedDateReturnsLastModifiedDateInUTC() { using (var tmp = new TempDirectory()) { var dir = new LocalFileSystemDirectory(tmp); using (var writer = dir.CreateTextFile("test.txt")) writer.WriteLine("Hello world"); var lastWriteTime = File.GetLastWriteTimeUtc(Path.Combine(tmp, "test.txt")); var lastModifiedDate = dir.GetLastModifiedDate("test.txt"); lastModifiedDate.Should().Be(lastWriteTime); } }