Example #1
0
        public void Given_Namespace_Generate_CSharp(
            string testName,
            List <string> @namespace,
            string expectedCode)
        {
            Debug.Write(testName);
            var codeFormatter = new CodeFormatterWorkerspace(@"../../../CSharpTools.CodeGenerator.Tests.csproj");

            var sut = new NamespaceBuilder();

            var res = codeFormatter.Format(sut.Build(@namespace));

            Assert.Equal(expectedCode, res.ToFullString());
        }
Example #2
0
        public void Given_Interface_Create_MockedInterfaceBuilder(
            string testName,
            Interface @interface,
            string expectedMockedInterfaceBuilder)
        {
            Debug.Write(testName);

            var namespaceBuilder = BuildIoC().Resolve <IBuilder <NamespaceDeclarationSyntax, List <string> > >();
            var @namespace       = namespaceBuilder.Build(new List <string> {
                "Test"
            });

            var sut = BuildIoC().Resolve <IBuilder <ClassDeclarationSyntax, Interface> >();
            var res = sut.Build(@interface);

            @namespace = @namespace.AddMembers(res);

            var codeFormatter   = new CodeFormatterWorkerspace(@"../../../CSharpTools.CodeGenerator.Tests.csproj");
            var formattedResult = codeFormatter.Format(@namespace).ToFullString();

            Assert.Equal(
                expectedMockedInterfaceBuilder,
                formattedResult);
        }