在我的应用程序中,我需要显示货币换算。
例如:
1 ?= 0.015 $
Run Code Online (Sandbox Code Playgroud)
同样,我想显示从 AED 到 USD 的转换。当我尝试时,转换方程会失真。
1 ?.? = 0.99 $
Run Code Online (Sandbox Code Playgroud) 我正在尝试测试我的存储库方法,该方法使用 QueryAsync() 并且它位于事务下。所以我在嘲笑 IDbConnection 和 IDbTransaction。但是当我运行测试用例时它给出了错误
“无法将‘Castle.Proxies.IDbTransactionProxy’类型的对象转换为‘System.Data.Common.DbTransaction’类型”
using System;
using Dapper;
using Moq;
using Moq.Dapper;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public class ComplexType
{
public string StringProperty { get; set; }
public int IntegerProperty { get; set; }
}
private static void TestMoqDapperExecuteAsyncIDbConnectionWithoutTransaction()
{
var connection = new Mock<IDbConnection>();
connection.SetupDapperAsync(c => c.QueryAsync<int>(It.IsAny<string>(), It.IsAny<object>(), It.IsAny<IDbTransaction>(), It.IsAny<int>(), It.IsAny<CommandType>()))
.ReturnsAsync(new List<int>
{
5
});
var result = connection.Object
.QueryAsync<int>("")
.GetAwaiter()
.GetResult();
Console.WriteLine(string.Format(" Test without transaction {0}", …
Run Code Online (Sandbox Code Playgroud)