Beispiel #1
0
        public async Task HandleGetHistoryQuery_ShouldReturnEmptyListOfHistory_WhenTagHasNoHistory()
        {
            using (var context = new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher,
                                                _currentUserProvider))
            {
                var dut    = new GetHistoryQueryHandler(context);
                var result = await dut.Handle(new GetHistoryQuery(_invitationWithNoHistory.Id), default);

                Assert.AreEqual(0, result.Data.Count);
            }
        }
Beispiel #2
0
        public async Task HandleGetHistoryQuery_ShouldReturnOkResult()
        {
            using (var context = new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher,
                                                _currentUserProvider))
            {
                var dut    = new GetHistoryQueryHandler(context);
                var result = await dut.Handle(_query, default);

                Assert.AreEqual(ResultType.Ok, result.ResultType);
            }
        }
Beispiel #3
0
        public async Task HandleGetHistoryQuery_ShouldReturnNotFound_WhenTagNotFound()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new GetHistoryQueryHandler(context);
                var result = await dut.Handle(new GetHistoryQuery(0), default);

                Assert.IsNotNull(result);
                Assert.AreEqual(ResultType.NotFound, result.ResultType);
                Assert.IsNull(result.Data);
            }
        }
Beispiel #4
0
        public async Task HandleGetHistoryQuery_ShouldReturnCorrectHistory_WhenTagHasHistory()
        {
            using (var context = new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher,
                                                _currentUserProvider))
            {
                var dut    = new GetHistoryQueryHandler(context);
                var result = await dut.Handle(_query, default);

                Assert.AreEqual(2, result.Data.Count);
                AssertHistory(_historyCompleteIpo, result.Data.Single(t => t.EventType == EventType.IpoCompleted));
                AssertHistory(_historyAcceptIpo, result.Data.Single(t => t.EventType == EventType.IpoAccepted));
            }
        }