Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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));
        }