Exemplo n.º 1
0
        public async Task TestImport2ReferenceSurfaceFiles(string uriRoot1, string uriRoot2)
        {
            const string testText = "File Import ref test 3";

            Msg.Title(testText, "Create standard project and customer then upload two Reference surface files");
            var ts                    = new TestSupport();
            var customerUid           = Guid.NewGuid();
            var startDateTime         = ts.FirstEventDate;
            var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(createProjectResponse.Result.Id);

            var importFileParent = new ImportFile(uriRoot1);
            var importFileChild  = new ImportFile(uriRoot2);
            //Parent Design
            var importFilename = TestFileResolver.File(TestFile.TestDesignSurface1);
            var parentName     = TestFileResolver.GetFullPath(importFilename);

            var importFileArray = new[] {
                "| EventType              | ProjectUid   | CustomerUid   | Name          | ImportedFileType | FileCreatedUtc  | FileUpdatedUtc             | ImportedBy                 | IsActivated | MinZoomLevel | MaxZoomLevel |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {parentName} | 1                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        | 15           | 19           |"
            };
            var filesResult1 = await importFileParent.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename}" }));

            var expectedResult1 = importFileParent.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult1.ImportedFileDescriptor, importFileParent.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor, true);
            //Reference Surfaces
            var parentUid = filesResult1.ImportedFileDescriptor.ImportedFileUid;
            var offset1   = 1.5;
            var offset2   = -2.5;

            parentName = Path.GetFileNameWithoutExtension(parentName);
            var name1            = $"{parentName} +{offset1}m";
            var name2            = $"{parentName} {offset2}m";
            var importFileArray2 = new[] {
                "| EventType              | ProjectUid   | CustomerUid   | Name    | ImportedFileType | FileCreatedUtc  | FileUpdatedUtc             | ImportedBy                 | IsActivated | MinZoomLevel | MaxZoomLevel | ParentUid   | Offset    |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {name1} | 6                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        | 15           | 19           | {parentUid} | {offset1} |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {name2} | 6                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        | 15           | 19           | {parentUid} | {offset2} |"
            };
            var filesResult2 = await importFileChild.SendRequestToFileImportV6(ts, importFileArray2, 1, new ImportOptions(HttpMethod.Post, new[] { $"filename={HttpUtility.UrlEncode(name1)}" }));

            var expectedResult2 = importFileChild.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult2.ImportedFileDescriptor, expectedResult2, true);

            var filesResult3 = await importFileChild.SendRequestToFileImportV6(ts, importFileArray2, 2, new ImportOptions(HttpMethod.Post, new[] { $"filename={HttpUtility.UrlEncode(name2)}" }));

            var expectedResult3 = importFileChild.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult3.ImportedFileDescriptor, expectedResult3, true);

            var importFileList = await importFileParent.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.True(importFileList.ImportedFileDescriptors.Count == 3, "Expected 3 imported files but got " + importFileList.ImportedFileDescriptors.Count);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[0], expectedResult1, true);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[1], expectedResult2, true);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[2], expectedResult3, true);
        }
Exemplo n.º 2
0
        public async Task TestImportANewFileThenUpdateTheAlignmentFile(string uriRoot)
        {
            const string testText = "File Import align test 3";

            Msg.Title(testText, "Create standard project then upload a new alignment file. Then update alignment file");
            var ts                    = new TestSupport();
            var customerUid           = Guid.NewGuid();
            var startDateTime         = ts.FirstEventDate;
            var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(createProjectResponse.Result.Id);

            var importFile     = new ImportFile(uriRoot);
            var importFilename = TestFileResolver.File(TestFile.TestAlignment1);
            var fullFilePath   = TestFileResolver.GetFullPath(importFilename);

            var importFileArray = new[] {
                "| EventType              | ProjectUid      | CustomerUid   | Name           | ImportedFileType | FileCreatedUtc  | FileUpdatedUtc             | ImportedBy                 | IsActivated | MinZoomLevel | MaxZoomLevel |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath} | 3                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        | 15           | 19           |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath} | 3                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        | 15           | 19           |"
            };
            var filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename}" }));

            var expectedResult1 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult.ImportedFileDescriptor, expectedResult1, true);

            await importFile.SendRequestToFileImportV6(ts, importFileArray, 2, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename}" }), HttpStatusCode.BadRequest);

            var expectedResult2 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;
            var importFileList  = await importFile.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.True(importFileList.ImportedFileDescriptors.Count == 1, "Expected 1 imported files but got " + importFileList.ImportedFileDescriptors.Count);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[0], expectedResult2, true);
        }
Exemplo n.º 3
0
        public async Task GetImportedFiles_should_return_activation_state()
        {
            const string testText = "File Activation test 1";

            Msg.Title(testText, "Get all activated import files");
            var ts                    = new TestSupport();
            var customerUid           = Guid.NewGuid();
            var startDateTime         = ts.FirstEventDate;
            var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(createProjectResponse.Result.Id);

            var importFile      = new ImportFile();
            var importFilename1 = TestFileResolver.File(TestFile.TestAlignment1);
            var fullFilePath1   = TestFileResolver.GetFullPath(importFilename1);
            var importFilename2 = TestFileResolver.File(TestFile.TestAlignment2);
            var fullFilePath2   = TestFileResolver.GetFullPath(importFilename2);

            var importFileArray = new[] {
                "| EventType               | ProjectUid      | CustomerUid   | Name            | ImportedFileType | FileCreatedUtc  | FileUpdatedUtc             | ImportedBy                 | IsActivated |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath1} | 3                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath2} | 3                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | true        |"
            };

            var filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post));

            var expectedResult = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            expectedResult.IsActivated = true;

            ts.CompareTheActualImportFileWithExpected(filesResult.ImportedFileDescriptor, expectedResult, true);
            filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 2, new ImportOptions(HttpMethod.Post));

            expectedResult = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            expectedResult.IsActivated = true;
            ts.CompareTheActualImportFileWithExpectedV6(filesResult.ImportedFileDescriptor, expectedResult, true);

            var importFileList = await importFile.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.True(importFileList.ImportedFileDescriptors.Count == 2, "Expected 2 imported files but got " + importFileList.ImportedFileDescriptors.Count);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[1], expectedResult, true);

            var activatedFileList = await importFile.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.Equal(2, activatedFileList.ImportedFileDescriptors.Count);
        }
Exemplo n.º 4
0
        public async Task TestImport2SurveyedSurfaceFiles(string uriRoot)
        {
            const string testText = "File Import v2";

            Msg.Title(testText, "Create standard project and customer then upload two Surveryed surface files");
            var ts                    = new TestSupport();
            var customerUid           = Guid.NewGuid();
            var startDateTime         = ts.FirstEventDate;
            var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(createProjectResponse.Result.Id);

            var importFile      = new ImportFile(uriRoot);
            var importFilename1 = TestFileResolver.File(TestFile.TestDesignSurface1);
            var importFilename2 = TestFileResolver.File(TestFile.TestDesignSurface2);

            var importFileArray = new[] {
                "| EventType              | ProjectUid      | CustomerUid   | Name                                            | ImportedFileType | FileCreatedUtc  | FileUpdatedUtc             | ImportedBy                 | SurveyedUtc     | IsActivated | MinZoomLevel | MaxZoomLevel |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {TestFileResolver.GetFullPath(importFilename1)} | 2                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | {startDateTime} | true        | 0            | 0            |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {TestFileResolver.GetFullPath(importFilename2)} | 2                | {startDateTime} | {startDateTime.AddDays(5)} | [email protected] | {startDateTime} | true        | 0            | 0            |"
            };
            var filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename1}" }));

            var expectedResult1 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult.ImportedFileDescriptor, expectedResult1, true);

            var filesResult2 = await importFile.SendRequestToFileImportV6(ts, importFileArray, 2, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename2}" }));

            var expectedResult2 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult2.ImportedFileDescriptor, expectedResult2, true);

            var importFileList = await importFile.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.True(importFileList.ImportedFileDescriptors.Count == 2, "Expected 2 imported files but got " + importFileList.ImportedFileDescriptors.Count);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[0], expectedResult1, true);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[1], expectedResult2, true);
        }
Exemplo n.º 5
0
        public async Task TestImportANewFileThenUpdateTheFileThenDeleteTheFile(string uriRoot)
        {
            const string testText = "File Import Misc 3";

            Msg.Title(testText, "Inset a new file, upsert a new version and then delete the file");
            var ts                    = new TestSupport();
            var customerUid           = Guid.NewGuid();
            var startDateTime         = ts.FirstEventDate;
            var createProjectResponse = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(createProjectResponse.Result.Id);

            var importFile     = new ImportFile(uriRoot);
            var importFilename = TestFileResolver.File(TestFile.TestDesignSurface1);
            var fullFilePath   = TestFileResolver.GetFullPath(importFilename);

            var importFileArray = new[] {
                "| EventType              | ProjectUid      | CustomerUid   | Name           | ImportedFileType | FileCreatedUtc              | FileUpdatedUtc              | ImportedBy                 | SurveyedUtc     | IsActivated | MinZoomLevel | MaxZoomLevel |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath} | 2                | {startDateTime}             | {startDateTime.AddDays(5)}  | [email protected] | {startDateTime} | true        | 0            | 0            |",
                $"| ImportedFileDescriptor | {ts.ProjectUid} | {customerUid} | {fullFilePath} | 2                | {startDateTime.AddDays(10)} | {startDateTime.AddDays(10)} | [email protected] | {startDateTime} | true        | 0            | 0            |"
            };
            var filesResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Post, new[] { $"filename={importFilename}" }));

            var expectedResult1 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;

            ts.CompareTheActualImportFileWithExpected(filesResult.ImportedFileDescriptor, expectedResult1, true);

            _ = await importFile.SendRequestToFileImportV6(ts, importFileArray, 2, new ImportOptions(HttpMethod.Put, new[] { $"filename={importFilename}" }));

            var expectedResult2 = importFile.ExpectedImportFileDescriptorSingleResult.ImportedFileDescriptor;
            var importFileList  = await importFile.GetImportedFilesFromWebApi <ImportedFileDescriptorListResult>($"api/v6/importedfiles?projectUid={ts.ProjectUid}", customerUid);

            Assert.True(importFileList.ImportedFileDescriptors.Count == 1, "Expected 1 imported files but got " + importFileList.ImportedFileDescriptors.Count);
            ts.CompareTheActualImportFileWithExpectedV6(importFileList.ImportedFileDescriptors[0], expectedResult2, true);

            importFile.ImportedFileUid = filesResult.ImportedFileDescriptor.ImportedFileUid;

            var deleteResult = await importFile.SendRequestToFileImportV6(ts, importFileArray, 1, new ImportOptions(HttpMethod.Delete));

            Assert.Equal(0, deleteResult.Code);
            Assert.Equal("success", deleteResult.Message);
        }