小编cze*_*h_u的帖子

调用模拟对象的异步方法时出现NullReferenceException

我正在尝试使用MOQ对以下ViewModel的LoginExecute方法进行单元测试

public class LoginViewModel : ViewModelBase, ILoginViewModel
{
    INavigationService navigationService;
    IDialogService dialogService;
    IAdminService adminService;

    public RelayCommand LoginCommand { get; set; }

    private string _productID;

    public string ProductID
    {
        get { return _productID; }
        set
        {
            _productID = value;
            RaisePropertyChanged("ProductID");
        }
    }

    public LoginViewModel(INavigationService navigationService, IDialogService dialogService, IAdminService adminService)
    {
        this.navigationService = navigationService;
        this.dialogService = dialogService;
        this.adminService = adminService;
        InitializeCommands();
    }

    private void InitializeCommands()
    {
        LoginCommand = new RelayCommand(() => LoginExecute());
    }

    public async Task LoginExecute()
    {
        await this.navigationService.TestMethod();
        this.navigationService.Navigate(typeof(ITherapistsViewModel));
    } …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing mstest asynchronous mocking

11
推荐指数
2
解决办法
4190
查看次数

查询 Azure 存储表是否始终是 1 个事务?

假设我有一个包含 50K 行的 Azure 存储表,其中包含这样的实体

 {
  PartitionKey,
  RowKey,
  Name,
  Price
}
Run Code Online (Sandbox Code Playgroud)

查询会是这样的

var query = from entity in dataServiceContext.CreateQuery<MyEntity>(tableName)
                 where entity.Price == 10
                 select new { entity.Name};
Run Code Online (Sandbox Code Playgroud)

当我需要搜索 Price == 10 的所有实体时,交易是否仅根据返回的结果数进行计数?或者每个实体 (entity.Price == 10) 的检查是否会被计为单独的读取事务,这会导致 50K 事务?

transactions azure azure-table-storage

2
推荐指数
1
解决办法
719
查看次数