public void TestTryGetNotExistingOlympiad() { var useCase = new GetOlympiadListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetOlympiadListUseCaseRequest.CreateOlympiadRequest(999), outputPort).Result); Assert.Empty(outputPort.Olympiads); }
public void TestGetAlllympiadsFromEmptyRepository() { var useCase = new GetOlympiadListUseCase(new InMemoryOlympiadRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetOlympiadListUseCaseRequest.CreateAllOlympiadsRequest(), outputPort).Result); Assert.Empty(outputPort.Olympiads); }
public void TestGetOlympiad() { var useCase = new GetOlympiadListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetOlympiadListUseCaseRequest.CreateOlympiadRequest(2), outputPort).Result); Assert.Single(outputPort.Olympiads, r => 2 == r.Id); }
public void TestGetAllOlympiads() { var useCase = new GetOlympiadListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetOlympiadListUseCaseRequest.CreateAllOlympiadsRequest(), outputPort).Result); Assert.Equal <int>(4, outputPort.Olympiads.Count()); Assert.Equal(new long[] { 1, 2, 3, 4 }, outputPort.Olympiads.Select(o => o.Id)); }