Test encoding of Chinese characters with Handlebars-Net
Set Configuration.NoEscape to True
- Expected:
using System;
using System.Collections.Generic;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
public partial class
{
/// <summary>
/// 编号
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ProductName { get; set; }
}
}- Actual:
Test passed: Actual output matches expected. No comments are escaped.
using System;
using System.Collections.Generic;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
public partial class
{
/// <summary>
/// 编号
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ProductName { get; set; }
}
}- Expected:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
[Table("Product")]
[Index(nameof(CategoryId), Name = "IX_Product_CategoryId")]
public partial class
{
/// <summary>
/// 编号
/// </summary>
[Key]
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required]
[StringLength(40)]
[Column(TypeName = "money")]
public string ProductName { get; set; }
}
}- Actual:
Test failed: Comment on ProductName property IS escaped (when it should not be).
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
[Table("Product")]
[Index(nameof(CategoryId), Name = "IX_Product_CategoryId")]
public partial class
{
/// <summary>
/// 编号
/// </summary>
[Key]
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required]
[StringLength(40)]
[Column(TypeName = "money")]
public string ProductName { get; set; }
}
}Set Configuration.NoEscape to False
- Expected:
using System;
using System.Collections.Generic;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
public partial class
{
/// <summary>
/// 编号
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ProductName { get; set; }
}
}- Actual:
Test failed: Properties are NOT escaped (when they should be).
using System;
using System.Collections.Generic;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
public partial class
{
/// <summary>
/// 编号
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ProductName { get; set; }
}
}- Expected:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
[Table("Product")]
[Index(nameof(CategoryId), Name = "IX_Product_CategoryId")]
public partial class
{
/// <summary>
/// 编号
/// </summary>
[Key]
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required]
[StringLength(40)]
[Column(TypeName = "money")]
public string ProductName { get; set; }
}
}- Actual:
Test failed: ProductId property is NOT escaped (when it should be).
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace FakeNamespace
{
/// <summary>
/// 产品
/// </summary>
[Table("Product")]
[Index(nameof(CategoryId), Name = "IX_Product_CategoryId")]
public partial class
{
/// <summary>
/// 编号
/// </summary>
[Key]
public int ProductId { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required]
[StringLength(40)]
[Column(TypeName = "money")]
public string ProductName { get; set; }
}
}