Ejemplo n.º 1
0
            public void Should_Throw_If_Context_Is_Null()
            {
                // Given, When
                var result = Record.Exception(() =>
                                              FileExtensions.CopyFileToDirectory(null, "./file.txt", "./target"));

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("context", ((ArgumentNullException)result).ParamName);
            }
Ejemplo n.º 2
0
            public void Should_Copy_File()
            {
                // Given
                var fixture = new FileCopyFixture();

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

                // Then
                fixture.TargetFiles[0].Received(1).Copy(
                    Arg.Is <FilePath>(p => p.FullPath == "/Working/target/file1.txt"), true);
            }
Ejemplo n.º 3
0
            public void Should_Throw_If_Target_Directory_Path_Is_Null()
            {
                // Given
                var context = Substitute.For <ICakeContext>();

                // When
                var result = Record.Exception(() =>
                                              FileExtensions.CopyFileToDirectory(context, "./file.txt", null));

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