public void MapMethodSignatureWithBody_WithBody_Create_ReturnsMethod()
        {
            var sourceType        = typeof(User);
            var targetType        = typeof(UserView);
            var localTargetSyntax = LocalTargetVariable.Create(targetType);
            var returnSyntax      = ReturnTarget.Create();
            var body = new StatementSyntax[] { localTargetSyntax, returnSyntax };

            var syntax = MapMethodSignatureWithBody.Create(sourceType, targetType, body);

            syntax.NormalizeWhitespace().ToFullString().ShouldBe(
                "public HyperMap.Tests.Support.UserView Map(HyperMap.Tests.Support.User source)\r\n" +
                "{\r\n" +
                "    var target = new HyperMap.Tests.Support.UserView();\r\n" +
                "    return target;\r\n" +
                "}");
        }
Пример #2
0
        public void ReturnTarget_Target_Create_ReturnsReturnTarget()
        {
            var syntax = ReturnTarget.Create();

            syntax.NormalizeWhitespace().ToFullString().ShouldBe("return target;");
        }