public void SetUp()
 {
     _mockFileSystem    = FileSystemTestUtils.CreateMock();
     _configurationName = "config.yaml";
     _path = new FileSystemPath(@"foo\bar");
     _configurationPath = _path.Join(_configurationName);
 }
        public void FileSystem_returns_the_filesystem_from_constructor()
        {
            var mockFileSystem = FileSystemTestUtils.CreateMock();

            var testObject = new TestFileSystemBasedObject(mockFileSystem.Object);

            Assert.AreSame(mockFileSystem.Object, testObject.FileSystem);
        }
예제 #3
0
        private Mock <IFileSystem> SetupFileSystemMock()
        {
            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupExistance(_testPath, FileSystemTestUtils.PathExistance.File);

            return(fileSystemMock);
        }
예제 #4
0
        public void ListDirectoryFilterByExtensionSorted_sorts_the_paths_and_filters_out_other_extensions()
        {
            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupListDir(_testPath, @"moo.foO", @"moo.bAr", @"moo.baz");

            var result = fileSystemMock.Object.ListDirectoryFilterByExtensionSorted(_testPath, "foo", "BAR");

            AssertPathList(result, @"moo.bAr", @"moo.foO");
        }
예제 #5
0
        public void ListDirectorySorted_sorts_the_paths()
        {
            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupListDir(_testPath, @"abc\yyz", @"bbc\xyz", @"abc\xyz");

            var result = fileSystemMock.Object.ListDirectorySorted(_testPath);

            AssertPathList(result, @"abc\xyz", @"abc\yyz", @"bbc\xyz");
        }
        public void SetUp()
        {
            _dateTimeProvider = new ManualDateTimeProvider();
            _dateTimeProvider.CurrentDateTime = new DateTime(2012, 12, 12, 13, 45, 32, 123, DateTimeKind.Utc).ToUtcAndLocal();

            _fileSystemMock = FileSystemTestUtils.CreateMock();
            _reportFilePath = new FileSystemPath("/foo/bar");

            _periodicReportFile = new PeriodicReportFile(_dateTimeProvider, _fileSystemMock.Object, _reportFilePath);

            _fileSystemMock.SetupWritableFile(_reportFilePath, expected: null, exists: false);
        }
예제 #7
0
        public void ListSubdirectoriesSorted_sorts_the_paths_and_filters_out_non_directories()
        {
            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupListDir(_testPath, @"abc\yyz", @"bbc\xyz", @"abc\xyz");

            fileSystemMock.SetupExistance(new FileSystemPath(@"abc\yyz"), FileSystemTestUtils.PathExistance.File);
            fileSystemMock.SetupExistance(new FileSystemPath(@"bbc\xyz"), FileSystemTestUtils.PathExistance.Directory);
            fileSystemMock.SetupExistance(new FileSystemPath(@"abc\xyz"), FileSystemTestUtils.PathExistance.Directory);

            var result = fileSystemMock.Object.ListSubdirectoriesSorted(_testPath);

            AssertPathList(result, @"abc\xyz", @"bbc\xyz");
        }
        public void WriteReport_writes_report_to_file()
        {
            var report = new SerializableReport();

            report.Report("foo", "bar");
            var expected = "foo: bar\n";

            var path = new FileSystemPath("moo.report");

            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupWritableFile(path, expected);

            fileSystemMock.Object.WriteReport(path, report, append: false);

            fileSystemMock.AssertFileWritten(path, expected);
        }
예제 #9
0
 public void SetUp()
 {
     _mockFileSystem = FileSystemTestUtils.CreateMock();
     _path           = new FileSystemPath(@"foo\bar");
 }
예제 #10
0
 public void SetUp()
 {
     _mockFileSystem = FileSystemTestUtils.CreateMock();
     _path           = new FileSystemPath(@"foo\bar");
     _testObject     = new TestFileSystemPathBasedObjectTest(_mockFileSystem.Object, _path);
 }