Example #1
0
        public void DeleteFileByWildCardTest()
        {
            var step = new CreateStep();
            step.CreationPath = @"..\..\TestData\DeleteTest_FileToBeDeleted1.wildCardTestxml";
            var dl = new FileDataLoader();
            dl.FilePath = @"..\..\TestData\PurchaseOrder001.xml";
            step.DataSource = dl;
            step.Execute(new Context());

            step.CreationPath = @"..\..\TestData\DeleteTest_FileToBeDeleted2.wildCardTestxml";
            step.Execute(new Context());

            var deleteStep = new DeleteStep();
            deleteStep.FilePathsToDelete.Add(@"..\..\TestData\*.wildCardTestxml");
            deleteStep.Execute(new Context());

            try
            {
                var deletedFile = System.IO.File.Open(@"..\..\TestData\DeleteTest_FileToBeDeleted.wildCardTestxml", FileMode.Open,
                                    FileAccess.Read);
            }
            catch (System.IO.FileNotFoundException)
            {
                ; // Expected!                
            }
        }
Example #2
0
        public void CreateFileTest()
        {
            var step = new CreateStep();
            step.CreationPath = @"..\..\TestData\FileCreateStepTest.testdelxml";
            var dl = new FileDataLoader();
            dl.FilePath = @"..\..\TestData\PurchaseOrder001.xml";
            step.DataSource = dl;
            step.Execute(new Context());

            var readStep = new FileReadMultipleStep();
            readStep.DirectoryPath = @"..\..\TestData\.";
            readStep.SearchPattern = "*.testdelxml";

            var validation = new XmlValidationStep();
            var schemaPurchaseOrder = new SchemaDefinition
            {
                XmlSchemaPath =
                    @"..\..\TestData\PurchaseOrder.xsd",
                XmlSchemaNameSpace =
                    "http://SendMail.PurchaseOrder"
            };
            validation.XmlSchemas.Add(schemaPurchaseOrder);

            var xpathProductId = new XPathDefinition();
            xpathProductId.Description = "PONumber";
            xpathProductId.XPath = "/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']/*[local-name()='PONumber' and namespace-uri()='']";
            xpathProductId.Value = "12323";
            validation.XPathValidations.Add(xpathProductId);

            readStep.SubSteps.Add(validation);

            readStep.Execute(new Context());
        }
Example #3
0
        private TestCase BuildFirstTestCase()
        {
            var testCase1 = new TestCase {Name = "Copy First File Test"};

            var step = new CreateStep();
            step.CreationPath = @"File1.xml";
            var dl = new FileDataLoader();
            dl.FilePath = @"..\..\TestData\PurchaseOrder001.xml";
            step.DataSource = dl;
            step.Execute(new Context());

            testCase1.ExecutionSteps.Add(step);
            return testCase1;
        }