Esempio n. 1
0
            public void IncludesAllParameters()
            {
                Method method = new Method
                                (
                    false,
                    false,
                    false,
                    name: "myMethod",
                    parameters: new[]
                {
                    new Parameter("myParam1", new TypeReference("myParamTypeFqn1")),
                    new Parameter("myParam2", new TypeReference("myParamTypeFqn2")),
                }
                                );

                Symbols.MapTypeName("myParamTypeFqn1", "MyParamType1", JsonModel.Spec.TypeKind.Class);
                Symbols.MapTypeName("myParamTypeFqn2", "MyParamType2", JsonModel.Spec.TypeKind.Class);
                Symbols.MapParameterName("myParam1", "myParam1");
                Symbols.MapParameterName("myParam2", "myParam2");

                ParameterListSyntax syntax = method.GetParameterListSyntax(Namespaces, Symbols);

                string actual   = syntax.NormalizeWhitespace(elasticTrivia: true).ToString();
                string expected = @"(MyParamType1 myParam1, MyParamType2 myParam2)";

                Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
            }
            public void DoesNotThrowOnMissingParameterList()
            {
                Method method = new Method
                                (
                    name: "myMethod"
                                );

                ParameterListSyntax syntax = method.GetParameterListSyntax(Namespaces, Symbols);

                string actual   = syntax.NormalizeWhitespace(elasticTrivia: true).ToString();
                string expected = @"()";

                Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
            }