Example #1
0
        public void GetProfilesNamespace()
        {
            var converter = new ConvertCimToWsdl();

            var filepath = @"..\..\Resources\WorkRequests.xsd";

            Assert.IsTrue(File.Exists(filepath));

            var data = filepath.ReadDataFromFile();

            var nmspc = data.GetProfilesNamespace();

            Assert.AreEqual("el", nmspc);

            filepath = @"..\..\Resources\SomeData.txt";

            Assert.IsTrue(File.Exists(filepath));

            data = filepath.ReadDataFromFile();

            nmspc = data.GetProfilesNamespace();

            Assert.AreEqual("", nmspc);

            filepath = @"..\..\Resources\UsagePointconfig.xsd";

            Assert.IsTrue(File.Exists(filepath));

            data = filepath.ReadDataFromFile();

            nmspc = data.GetProfilesNamespace();

            Assert.AreEqual("a", nmspc);
        }
Example #2
0
        public void GetTargetNamespace()
        {
            var converter = new ConvertCimToWsdl();

            var filepath = @"..\..\Resources\UsagePointconfig.xsd";

            Assert.IsTrue(File.Exists(filepath));

            var data = filepath.ReadDataFromFile();

            var nmspc = data.GetTargetNamespace();

            Assert.AreEqual("http://iec.ch/TC57/2011/UsagePointConfig#", nmspc);

            filepath = @"..\..\Resources\WorkRequests.xsd";

            Assert.IsTrue(File.Exists(filepath));

            data = filepath.ReadDataFromFile();

            nmspc = data.GetTargetNamespace();

            Assert.AreEqual("http://iec.ch/TC57/2011/WorkRequests", nmspc);
        }
Example #3
0
        public void CreateArtifacts_Profile()
        {
            var converter = new ConvertCimToWsdl();

            var filepath   = @"..\..\Resources\WorkRequests.xsd";
            var outXsdPath = @"xsd\";

            Assert.IsTrue(File.Exists(filepath));

            if (!Directory.Exists(outXsdPath))
            {
                Directory.CreateDirectory(outXsdPath);
            }

            Assert.IsTrue(Directory.Exists(outXsdPath));

            if (File.Exists(Path.Combine(outXsdPath, Path.GetFileName(filepath))))
            {
                File.Delete(Path.Combine(outXsdPath, Path.GetFileName(filepath)));
            }

            string targetNamespace = "";
            string noun2           = "";
            var    outXsdPath2     = converter.CreateArtifacts_Profile(filepath, outXsdPath, out noun2, out targetNamespace);

            Assert.AreEqual(Path.Combine(outXsdPath, Path.GetFileName(filepath)), outXsdPath2);
            Assert.AreEqual("WorkRequests", noun2);

            Assert.IsTrue(File.Exists(outXsdPath2));

            filepath   = @"..\..\Resources\UsagePointconfig.xsd";
            outXsdPath = @"xsd\";

            Assert.IsTrue(File.Exists(filepath));

            if (!Directory.Exists(outXsdPath))
            {
                Directory.CreateDirectory(outXsdPath);
            }

            Assert.IsTrue(Directory.Exists(outXsdPath));

            if (File.Exists(Path.Combine(outXsdPath, Path.GetFileName(filepath))))
            {
                File.Delete(Path.Combine(outXsdPath, Path.GetFileName(filepath)));
            }

            targetNamespace = "";
            noun2           = "";
            outXsdPath2     = converter.CreateArtifacts_Profile(filepath, outXsdPath, out noun2, out targetNamespace);

            Assert.AreEqual(Path.Combine(outXsdPath, Path.GetFileName(filepath)), outXsdPath2);
            Assert.AreEqual("UsagePointConfig#", noun2);

            Assert.IsTrue(File.Exists(outXsdPath2));


            filepath   = @"..\..\Resources\MeterReadSchedule.xsd";
            outXsdPath = @"xsd\";

            Assert.IsTrue(File.Exists(filepath));

            if (!Directory.Exists(outXsdPath))
            {
                Directory.CreateDirectory(outXsdPath);
            }

            Assert.IsTrue(Directory.Exists(outXsdPath));

            if (File.Exists(Path.Combine(outXsdPath, Path.GetFileName(filepath))))
            {
                File.Delete(Path.Combine(outXsdPath, Path.GetFileName(filepath)));
            }

            targetNamespace = "";
            noun2           = "";
            outXsdPath2     = converter.CreateArtifacts_Profile(filepath, outXsdPath, out noun2, out targetNamespace);

            Assert.AreEqual(Path.Combine(outXsdPath, Path.GetFileName(filepath)), outXsdPath2);
            Assert.AreEqual("MeterReadSchedule#", noun2);

            Assert.IsTrue(File.Exists(outXsdPath2));
        }