private async Task PopulateGridAsync() { var service = new ParticipantService(new ParticipantRepository()); var items = await service.GetAsync(); Application.Current.Dispatcher.Invoke(() => { ParticipantsGrid.ItemsSource = items; }); }
private static async Task ShowParticipantsAsync() { var service = new ParticipantService(new ParticipantRepository()); foreach (ParticipantDTO item in await service.GetAsync(0, 5)) { Console.WriteLine($"{item.Id};{item.FIO};{item.Birthdate.ToShortDateString()};{item.Email};{item.Phone}"); } }
public async Task Get_DontExist_ShouldReturnNull() { // Arrange var options = BuildContextOptions(); using (var context = new BorrowBuddyContext(options)) { var service = new ParticipantService(context); // Act var result = await service.GetAsync(Guid.NewGuid()); // Assert Assert.Null(result); } }
public async Task Get_Exists_ShouldReturnParticipants() { // Arrange var options = BuildContextOptions(); using (var context = new BorrowBuddyContext(options)) { context.AddParticipant(); context.AddParticipant(); context.SaveChanges(); } using (var context = new BorrowBuddyContext(options)) { var service = new ParticipantService(context); // Act var result = await service.GetAsync(); // Assert Assert.NotNull(result); Assert.Equal(2, result.Count); } }
public async Task <ActionResult <IEnumerable <Participant> > > GetParticipantAsync() { return((await _participantService.GetAsync()).Select(Mapper.Map).ToList()); }