示例#1
0
        void TestCreateInterface(string interfacecode, string outputString)
        {
            var dom = new SimpleProjectDom();

            var parser = new McsParser();
            var unit   = parser.Parse(dom, "Interface.cs", interfacecode);

            DomType stubType = new DomType("Stub");

            stubType.SourceProjectDom = dom;
            stubType.CompilationUnit  = new CompilationUnit("Stub.cs");
            var iface = unit.CompilationUnit.Types[0];
            var gen   = new CSharpCodeGenerator();

            gen.EolMarker = "\n";
            string generated = gen.CreateInterfaceImplementation(stubType, iface, false);

            // crop #region
            generated = generated.Substring(generated.IndexOf("implementation") + "implementation".Length);
            generated = generated.Substring(0, generated.LastIndexOf("#"));
            generated = generated.Trim();
            System.Console.WriteLine(generated);
            Assert.AreEqual(outputString, generated);
        }