Пример #1
0
        public string Generate(File file)
        {
            var code = "<?php ";

            if (!String.IsNullOrWhiteSpace(file.Namespace))
            {
                code += "namespace " + file.Namespace + ";";
            }

            foreach (var reference in file.References)
            {
                code += _referenceGenerator.Generate(reference);
            }

            foreach (var @class in file.Classes)
            {
                code += _classGenerator.Generate(@class);
            }

            return(code);
        }
        //[Test]
        //public void GivenRepresentationWhenGetInstancesThenInstancesMatchDomainIds()
        //{
        //    foreach (var field in typeof(RepresentationInstanceList).GetFields())
        //    {
        //        var value = (ApplicationDataModel.Representation)field.GetValue(null);
        //        Assert.AreEqual(field.Name, value.DomainId);
        //    }
        //}

        private static void GenerateClass(string filePath, IClassGenerator generator)
        {
            var classString = generator.Generate();
            File.WriteAllText(filePath, classString);
        }
        //[Test]
        //public void GivenRepresentationWhenGetInstancesThenInstancesMatchDomainIds()
        //{
        //    foreach (var field in typeof(RepresentationInstanceList).GetFields())
        //    {
        //        var value = (ApplicationDataModel.Representation)field.GetValue(null);
        //        Assert.AreEqual(field.Name, value.DomainId);
        //    }
        //}

        private static void GenerateClass(string filePath, IClassGenerator generator)
        {
            var classString = generator.Generate();

            File.WriteAllText(filePath, classString);
        }