public void Should_build_argument_from_property_with_method_Call()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument(x => x.Company.AsJson());

            var typeTemplateModel = typeTemplate.GetModel();

            typeTemplateModel.Arguments.Single().Name.Should().Be("CompanyAsJson");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("$this.Company.AsJson()");
        }
        public void Should_build_argument_from_property_with_datetime_coaless()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument(x => (x.SomeDate ?? DateTime.MinValue));

            var typeTemplateModel = typeTemplate.GetModel();

            typeTemplateModel.Arguments.Single().Name.Should().Be("SomeDate");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("$this.SomeDate ?? DateTime.MinValue");
        }
        public void Should_build_argument_from_property_with_null_coaless()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument(x => (x.Id ?? ""));

            var typeTemplateModel = typeTemplate.GetModel();

            typeTemplateModel.Arguments.Single().Assignment.Should().Be("Id");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("$this.Id ?? \"\"");
        }
        public void Should_build_argument_from_sub_property()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument(x => x.Company.Id);

            var typeTemplateModel = typeTemplate.GetModel();

            typeTemplateModel.Arguments.Single().Name.Should().Be("CompanyId");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("$this.Company.Id");
        }
        public void Should_build_argument_from_static_method_with_extensionMethod()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument("correlationId", x => ContextExtensionMethods.GetCurrent("correlationId"));

            var typeTemplateModel = typeTemplate.GetModel();

            Console.WriteLine(typeTemplateModel.Arguments.Single().Assignment);
            typeTemplateModel.Arguments.Single().Name.Should().Be("correlationId");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("ContextExtensionMethods.GetCurrent(\"correlationId\")");
        }
        public void Should_build_argument_from_static_method_with_indexer_property_call()
        {
            var typeTemplate = new TypeTemplate <Employee>();

            typeTemplate.AddArgument("correlationId", x => Context.Current == null ? "" : Context.Current["correlationId"]);

            var typeTemplateModel = typeTemplate.GetModel();

            Console.WriteLine(typeTemplateModel.Arguments.Single().Assignment);
            typeTemplateModel.Arguments.Single().Name.Should().Be("correlationId");
            typeTemplateModel.Arguments.Single().Assignment.Should().Be("Context.Current == null ? \"\" : Context.Current[\"correlationId\"]");
        }