Example #1
0
        public async Task ManualTRexTest_CreateImportedFile(string uriRoot)
        {
            const string testText = "File Import Misc 2";

            Msg.Title(testText, "Create standard project then upload a new design surface 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.TestDesignSurface3_GoodContent);
            var fullFilePath   = TestFileResolver.GetFullPath(importFilename);

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

            Assert.NotNull(filesResult);
            Assert.Equal(0, filesResult.Code);
            Assert.Equal(ts.ProjectUid.ToString(), filesResult.ImportedFileDescriptor.ProjectUid);

            var trexService   = new TRex();
            var designsResult = await trexService.GetDesignsFromTrex(customerUid.ToString(), ts.ProjectUid.ToString());

            Assert.Equal(0, designsResult.Code);
            Assert.Single(designsResult.DesignFileDescriptors);
            Assert.Equal(filesResult.ImportedFileDescriptor.ImportedFileUid, designsResult.DesignFileDescriptors[0].DesignUid);
            Assert.Equal("TestDesignSurface3_GoodContent.TTM", designsResult.DesignFileDescriptors[0].Name);
        }