public void NullToViewModelTest() { //Arrange //Act var vm = _vmConverter.ToViewModel(null); //Assert Assert.IsNull(vm); }
/// <inheritdoc /> public async Task <IEnumerable <VmProject> > GetPage(ApplicationUser currentUser, int teamId, PageOptions pageOptions) { if (currentUser == null) { throw new ArgumentNullException(nameof(currentUser)); } if (pageOptions == null) { throw new HttpResponseException(HttpStatusCode.BadRequest, $"Parameter '{nameof(pageOptions)}' cannot be null"); } var query = GetQuery(teamId, pageOptions.WithRemoved); query = Filter(pageOptions.Filter, query); query = FilterByFields(pageOptions.FilterFields, query); query = SortByFields(pageOptions.SortFields, query); return(await query .Skip(pageOptions.PageNumber *pageOptions.PageSize) .Take(pageOptions.PageSize) .Select(pt => _vmConverter.ToViewModel(pt.Project)) .ToArrayAsync()); }