FluentData.IntegrationTests/Features/Builders/Update/AutoMapTests.cs
(完整代码) 1KBusing FluentData._Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FluentData.Features.Builders.Update
{
[TestClass]
public class AutoMapTests
{
[TestMethod]
public void Enum_test()
{
using (var context = TestHelper.Context().UseTransaction(true))
{
var product = new ProductWithCategoryEnum();
product.Name = "Test";
product.CategoryId = Categories.Movies;
product.ProductId = context.Insert("Product", product).AutoMap(x => x.ProductId).ExecuteReturnLastId();
product = context.Sql("select * from Product where ProductId=@0", product.ProductId).QuerySingle<ProductWithCategoryEnum>();
Assert.AreEqual(Categories.Movies, product.CategoryId);
product.CategoryId = Categories.Books;
context.Update("Product", product).AutoMap(x => x.ProductId).Where(x => x.ProductId).Execute();
product = context.Sql("select * from Product where ProductId=@0", product.ProductId).QuerySingle<ProductWithCategoryEnum>();
Assert.AreEqual(Categories.Books, product.CategoryId);
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
