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

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