Ejemplo n.º 1
0
        public void FileMoveStepTest_Negative()
        {
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml");
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            File.Copy(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.xml",
                      @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            var step = new FileMoveStep();

            step.SourcePath      = string.Empty;
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml";

            try
            {
                step.Validate(new Context());
            }
            catch (ArgumentException ex)
            {
                Assert.IsTrue(ex.Message.Contains("SourcePath is either null or of zero length"));
            }


            step.SourcePath      = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml";
            step.DestinationPath = string.Empty;

            try
            {
                step.Validate(new Context());
            }
            catch (ArgumentException ex)
            {
                Assert.IsTrue(ex.Message.Contains("DestinationPath is either null or of zero length"));
            }


            step.SourcePath      = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xmlerror";
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xmlerror";

            try
            {
                var context = new Context();
                step.Validate(context);
                step.Execute(context);
            }
            catch (FileNotFoundException fex)
            {
                Assert.IsTrue(fex.Message.Contains("Could not find file"));
            }
        }
Ejemplo n.º 2
0
        public void FileMoveStepTest()
        {
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml");
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            File.Copy(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.xml",
                @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            var step = new FileMoveStep();
            step.SourcePath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml";
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml";

            step.Execute(new Context());

            Assert.IsTrue(File.Exists(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml"));
         
        }
Ejemplo n.º 3
0
        public void FileMoveStepTest()
        {
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml");
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            File.Copy(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.xml",
                      @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            var step = new FileMoveStep();

            step.SourcePath      = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml";
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml";

            step.Execute(new Context());

            Assert.IsTrue(File.Exists(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml"));
        }
Ejemplo n.º 4
0
        public void FileMoveStepTest_Negative()
        {
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml");
            TestHelper.DeleteFile(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            File.Copy(@"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.xml",
                @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml");

            var step = new FileMoveStep();
            step.SourcePath = string.Empty;
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel2xml";

            try
            {
                step.Validate(new Context());

            }
            catch (ArgumentException ex)
            {
                Assert.IsTrue(ex.Message.Contains("SourcePath is either null or of zero length"));
            }


            step.SourcePath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xml";
            step.DestinationPath = string.Empty;

            try
            {
                step.Validate(new Context());

            }
            catch (ArgumentException ex)
            {
                Assert.IsTrue(ex.Message.Contains("DestinationPath is either null or of zero length"));
            }


            step.SourcePath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xmlerror";
            step.DestinationPath = @"..\..\..\Test\BizUnit4Tests\TestData\PurchaseOrder001.testdel1xmlerror";

            try
            {
                var context = new Context();
                step.Validate(context);
                step.Execute(context);

            }
            catch (FileNotFoundException fex)
            {
                Assert.IsTrue(fex.Message.Contains("Could not find file"));
            }
           

        }