Exemplo n.º 1
0
            public void Should_Move_File()
            {
                // Given
                var fixture = new FileCopyFixture();

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

                // Then
                fixture.TargetFiles[0].Received(1).Move(
                    Arg.Is <FilePath>(p => p.FullPath == "/Working/target/file1.txt"));
            }
Exemplo n.º 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(() =>
                                              FileExtensions.MoveFileToDirectory(null, source, target));

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("context", ((ArgumentNullException)result).ParamName);
            }
Exemplo n.º 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(() =>
                                              FileExtensions.MoveFileToDirectory(context, source, null));

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("targetDirectoryPath", ((ArgumentNullException)result).ParamName);
            }