예제 #1
0
            public void Should_Move_File()
            {
                // Given
                var fixture = new FileCopyFixture();

                // When
                FileAliases.MoveFileToDirectory(fixture.Context, "./file1.txt", "./target");

                // Then
                fixture.TargetFiles[0].Received(1).Move(
                    Arg.Is <FilePath>(p => p.FullPath == "/Working/target/file1.txt"));
            }
예제 #2
0
            public void Should_Throw_If_Context_Is_Null()
            {
                // Given, When
                var source = new FilePath("./source.txt");
                var target = new DirectoryPath("./target");

                var result = Record.Exception(() =>
                                              FileAliases.MoveFileToDirectory(null, source, target));

                // Then
                Assert.IsArgumentNullException(result, "context");
            }
예제 #3
0
            public void Should_Throw_If_Target_File_Path_Is_Null()
            {
                // Given
                var context = Substitute.For <ICakeContext>();
                var source  = new FilePath("./source.txt");

                // When
                var result = Record.Exception(() =>
                                              FileAliases.MoveFileToDirectory(context, source, null));

                // Then
                Assert.IsArgumentNullException(result, "targetDirectoryPath");
            }
예제 #4
0
            public void Should_Throw_If_Source_File_Path_Is_Null()
            {
                // Given
                var context = Substitute.For <ICakeContext>();
                var target  = new DirectoryPath("./target");

                // When
                var result = Record.Exception(() =>
                                              FileAliases.MoveFileToDirectory(context, null, target));

                // Then
                AssertEx.IsArgumentNullException(result, "filePath");
            }