public async Task GetTickets_CheckTickets_ShouldBeEqual() { // Arrange var ticketsEqualityComparer = new TicketsEqualityComparer(); // Act var actualTickets = await ticketsService.GetTicketsAsync(acessToken, email); // Assert Assert.Equal(tickets, actualTickets, ticketsEqualityComparer); }
public async Task GetTickets_WhenSecurityTokenExpired() { // Arrange var ticketsEqualityComparer = new TicketsEqualityComparer(); httpServiceMock .SetupSequence(hs => hs.GetAsync <IEnumerable <TicketDto> >(It.IsAny <Uri>(), It.IsAny <string>())) .ReturnsAsync(() => null) .ReturnsAsync(ticketsDto); // Act var actualTickets = await ticketsService.GetTicketsAsync(acessToken, email); // Assert Assert.Equal(tickets, actualTickets, ticketsEqualityComparer); }
public MyTicketsViewModelTests() { dialogServiceMock = new Mock <IPageDialogService>(); tickets = new List <Ticket> { new Ticket { TicketType = "Unused", ReferenceNumber = "ReferenceNumber1", TicketAreas = new List <string> { "A" }, CreatedAt = DateTime.Parse("02/01/20 12:00:00") }, new Ticket { TicketType = "Activated", ReferenceNumber = "ReferenceNumber2", TicketAreas = new List <string> { "A", "B" }, CreatedAt = DateTime.Parse("02/02/20 13:00:00"), ActivatedAt = DateTime.Parse("02/02/20 13:00:00"), ExpiredAt = DateTime.Parse("02/07/20 14:00:00") }, new Ticket { TicketType = "Expired", ReferenceNumber = "ReferenceNumber3", TicketAreas = new List <string> { "A", "B", "C" }, CreatedAt = DateTime.Parse("02/03/20 14:00:00"), ActivatedAt = DateTime.Parse("02/03/20 14:00:00"), ExpiredAt = DateTime.Parse("02/06/20 15:00:00") } }; unusedTickets = new List <Ticket> { tickets.ElementAt(0) }; activatedTickets = new List <Ticket> { tickets.ElementAt(1) }; expiredTickets = new List <Ticket> { tickets.ElementAt(2) }; token = new Token { AcessJwtToken = "AccessToken", RefreshJwtToken = "RefreshToken" }; localTokenServiceMock = new Mock <ILocalTokenService>(); localTokenServiceMock .Setup(lts => lts.GetAccessTokenAsync()) .ReturnsAsync(token.AcessJwtToken); ticketsServiceMock = new Mock <ITicketsService>(); ticketsServiceMock .Setup(ts => ts.GetTicketsAsync(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(tickets); ticketsEqualityComparer = new TicketsEqualityComparer(); var email = "email"; navigationParameters = new NavigationParameters { { email, "email" } }; myTicketsViewModel = new MyTicketsViewModel(null, localTokenServiceMock.Object, dialogServiceMock.Object, ticketsServiceMock.Object); }