Exemplo n.º 1
0
        private async Task PopulateGridAsync()
        {
            var service = new ParticipantService(new ParticipantRepository());
            var items   = await service.GetAsync();

            Application.Current.Dispatcher.Invoke(() => { ParticipantsGrid.ItemsSource = items; });
        }
Exemplo n.º 2
0
        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}");
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
 public async Task <ActionResult <IEnumerable <Participant> > > GetParticipantAsync()
 {
     return((await _participantService.GetAsync()).Select(Mapper.Map).ToList());
 }