示例#1
0
        public async Task Handler_ShouldReturnTags_LimitedToMax()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query = new GetActionsCrossPlantQuery(1);
                var dut   = new GetActionsCrossPlantQueryHandler(context, _plantCacheMock.Object, _plantProvider);

                var result = await dut.Handle(query, default);

                Assert.IsNotNull(result);
                Assert.AreEqual(ResultType.Ok, result.ResultType);

                Assert.AreEqual(1, result.Data.Count);
            }
        }
示例#2
0
        public async Task Handler_ShouldReturnActions_FromDifferentPlants()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query = new GetActionsCrossPlantQuery();
                var dut   = new GetActionsCrossPlantQueryHandler(context, _plantCacheMock.Object, _plantProvider);

                var result = await dut.Handle(query, default);

                Assert.IsNotNull(result);
                Assert.AreEqual(ResultType.Ok, result.ResultType);

                var actionDtos = result.Data;
                Assert.AreEqual(2, actionDtos.Count);

                AssertAction(actionDtos.Single(a => a.Id == _actionA.Id), _actionA, _plantA, _projectA);
                AssertAction(actionDtos.Single(a => a.Id == _actionB.Id), _actionB, _plantB, _projectB);
            }
        }