Example #1
0
        static void Main(string[] args)
        {
            if (ArgumentsProcessing(args))
            {
                Subject subject = SerializerHelper.DeserializeFromXml <Subject>(AppConfig.ConfigPath); // Считывание данных из xml-файла

                /*List<ResultsFromRegionGrowing> depthMapResults =  DepthMap.Create(subject, true); // Построение карт глубины для субъекта
                 * List<int[,]> regionsMatrix =  DepthSegmentation.AutoRegionGrowing(depthMapResults, 9, 40, true, subject.OutputDataFolder); // Наращивание регионов по значениям карт глубин
                 * CoordinateTransform.TwoDMatricesInto3DSpace(subject, depthMapResults, regionsMatrix, true);*/
                List <Point3D> points3D = new List <Point3D>();

                points3D.Add(new Point3D(0, 0, 0));
                points3D.Add(new Point3D(0, 0, 10));
                points3D.Add(new Point3D(0, 10, 0));
                points3D.Add(new Point3D(0, 10, 10));
                points3D.Add(new Point3D(10, 10, 0));
                points3D.Add(new Point3D(10, 10, 10));
                points3D.Add(new Point3D(10, 0, 0));
                points3D.Add(new Point3D(10, 0, 10));
                points3D.Add(new Point3D(5, 5, 20));

                Builder3DModel.Create3DModel(points3D, subject.SubjectName, subject.OutputDataFolder);
            }
            Console.ReadKey();
        }
Example #2
0
        public void IntegrationTestBasicScenario()
        {
            string newClaimNumber = TestDataGenerator.GenerateUniqueClaimNumber();
            string postBody       = TestDataGenerator.GetTestClaimInXmlFormat(newClaimNumber);

            // =========================================
            // Create a new claim.
            HttpWebResponse httpWebResponse = WebServiceHelpers.PostClaim(postBody);

            Assert.AreEqual(HttpStatusCode.Created, httpWebResponse.StatusCode, "Posting a new claim should succeed.");

            string expectedClaimUrl = WebServiceHelpers.GetClaimUrl(newClaimNumber);

            Assert.AreEqual(expectedClaimUrl, httpWebResponse.Headers["Location"],
                            "Posting a new claim should return the correct location.");

            // =========================================
            // Read the same claim back and validate the result.
            string getRresponse = WebServiceHelpers.GetClaim(newClaimNumber);

            MitchellClaim retrievedClaim = SerializerHelper.DeserializeFromXml <MitchellClaim>(getRresponse);

            MitchellClaim expectedClaim = TestDataGenerator.GetTestClaim(newClaimNumber);

            Assert.AreEqual(expectedClaim, retrievedClaim,
                            "A claim before being posted and after being retrieved should contain the same data.");

            // =========================================
            // Update the same claim.
            string putBody = TestDataGenerator.GetTestClaimUpdateInXmlFormat(newClaimNumber);

            httpWebResponse = WebServiceHelpers.PutClaim(newClaimNumber, putBody);

            Assert.AreEqual(HttpStatusCode.OK, httpWebResponse.StatusCode, "Updating a claim should succeed.");

            // =========================================
            // Read the same claim back and validate the result.
            getRresponse   = WebServiceHelpers.GetClaim(newClaimNumber);
            retrievedClaim = SerializerHelper.DeserializeFromXml <MitchellClaim>(getRresponse);

            TestDataGenerator.UpdateClaim(expectedClaim);
            Assert.AreEqual(expectedClaim, retrievedClaim,
                            "The claim update operation did not update the claim data as expected.");

            // =========================================
            // Delete the same claim.
            httpWebResponse = WebServiceHelpers.DeleteClaim(newClaimNumber);
            Assert.AreEqual(HttpStatusCode.OK, httpWebResponse.StatusCode, "Deleting a claim should succeed.");

            // =========================================
            // Read the same claim back and validate the "Not Found" result.

            try
            {
                getRresponse = WebServiceHelpers.GetClaim(newClaimNumber);
                Assert.Fail("An attempt to retrieve a claim that was deleted should result in an error.");
            }
            catch (WebException wex)
                when(
                    wex.Response is System.Net.HttpWebResponse &&
                    ((System.Net.HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotFound)
                {
                    // This is what we expect.
                }
        }