public async Task Test_Service_Get_Requests() { var mock = new Mock <ILogger <MainService> >(); var service = new MainService(mock.Object); Player player1 = new Player("Felix"); Player player2 = new Player("Niklas"); Player player3 = new Player("Yannick"); Player player4 = new Player("Emanuel"); GameRequest request1 = new GameRequest(player1, player2); GameRequest request2 = new GameRequest(player3, player4); await service.AddGameRequestAsync(request1); await service.AddGameRequestAsync(request2); var requestList = service.GetGameRequestsAsync().Result.ToList(); Assert.Contains(request1, requestList); Assert.Contains(request2, requestList); Assert.AreEqual(2, requestList.Count); }
public async Task Test_Service_Remove_Request() { var mock = new Mock <ILogger <MainService> >(); var service = new MainService(mock.Object); Player player1 = new Player("Player1"); Player player2 = new Player("Player2"); var request = new GameRequest(player1, player2); var addedRequest = await service.AddGameRequestAsync(request); var removedRequest = await service.RemoveRequestAsync(addedRequest, false); Assert.AreEqual(addedRequest, removedRequest); }
public async Task Test_Service_Add_Request() { var mock = new Mock <ILogger <MainService> >(); var service = new MainService(mock.Object); Player player1 = new Player("Player1"); Player player2 = new Player("Player2"); GameRequest request = new GameRequest(player1, player2); await service.AddGameRequestAsync(request); var requestList = service.GetGameRequestsAsync().Result.ToList(); Assert.Contains(request, requestList); }