private async Task Querying_By_Exact_Match_Of_Text_CustomField_Works() { // GIVEN 2 custom fields _currentUserId = await SeedCurrentUsers(); var customFieldId = await CreateTextCustomField(); // and 2 backlog items with different custom field values var backlogItem1Id = await CreateBacklogItem(customFieldId, "val1"); await CreateBacklogItem(customFieldId, "val2"); // WHEN querying items by a custom field value var items = await _queryService.GetList( new BacklogItemListGetRequest { CustomField = new Dictionary <string, string> { { customFieldId, "val1" } } }); // THEN // the returned only one correct record Assert.Single(items.Entries); Assert.Equal(backlogItem1Id, items.Entries[0].Id); }
private async Task Querying_By_Created_User_Works() { // GIVEN 2 users (current and another one) var(homerId, margeId) = await SeedTwoUsers(); _currentUserId = homerId; // and 2 backlog items created by the 'current' user await CreateBacklogItem(); await CreateBacklogItem(); // and 1 by 'another' user _currentUserId = margeId; var anotherRef = await CreateBacklogItem(); _currentUserId = homerId; // WHEN querying items created by another user var items = await _queryService.GetList( new BacklogItemListGetRequest { UserModification = new BacklogItemModification { UserId = margeId, Type = BacklogItemModification.ModificationType.CreatedOnly } }); // THEN // the returned only 1 record created by 'another' user Assert.Equal(1, items.TotalRecords); Assert.Equal(margeId, items.Entries[0].Created.ActionedBy.Id); // with correct backlog ID Assert.Equal(anotherRef.Id, items.Entries[0].Id); }
private async Task Querying_By_Type_Works(BacklogItemType[]?type, int expectedRecordCount) { // GIVEN 3 backlog items of a different type var bugRef = await CreateBacklogItem <BugAddUpdRequest>(); var usRef = await CreateBacklogItem <UserStoryAddUpdRequest>(); var taskRef = await CreateBacklogItem <TaskAddUpdRequest>(); // WHEN querying by type var requiredType = type?.Select(t => t as BacklogItemType?).ToArray(); var items = await _queryService.GetList(new BacklogItemListGetRequest { Types = requiredType }); // THEN // the returned number of records is correct Assert.Equal(expectedRecordCount, items.TotalRecords); }
private async Task Querying_By_Tag_Works() { // GIVEN 2 backlog items var itemRef1 = await CreateBacklogItem("tag1"); var itemRef2 = await CreateBacklogItem("tag1", "tag2"); // WHEN querying items by 'tag2' var items = await _queryService.GetList( new BacklogItemListGetRequest { Tags = new [] { "tag2" } }); // THEN // the returned only 1 record Assert.Equal(1, items.TotalRecords); // with correct ID Assert.Equal(itemRef2.Id, items.Entries.First().Id); }
private async Task Querying_By_Type_Works(BacklogItemType type, int expectedRecordCount) { // GIVEN two backlog items: a bug and a user story var bugRef = await CreateBacklogItem <BugAddUpdRequest>(); var usRef = await CreateBacklogItem <UserStoryAddUpdRequest>(); // WHEN querying by type var items = await _queryService.GetList(new BacklogItemListGetRequest { Type = type }); // THEN // the returned number of records is correct Assert.Equal(expectedRecordCount, items.TotalRecords); if (expectedRecordCount == 1) { // with correct type Assert.Equal(type, items.Entries.First().Type); // and with correct ID Assert.Equal((type == BacklogItemType.Bug) ? bugRef.Id : usRef.Id, items.Entries.First().Id); } }
public Task <ListResponse <BacklogItemListGetResponse> > GetList([FromServices] IBacklogItemListQueryService service, [FromQuery] BacklogItemListGetRequest dto) => service.GetList(dto);