Esempio n. 1
0
        public IList <string> Handle(GetActionsQuery theQuery)
        {
            var session = BuildSession();
            var query   = session.QueryOver <ActionAccessPrivilege>()
                          .Select(Projections.Distinct(Projections.Property <ActionAccessPrivilege>(x => x.Action)));

            return(query.List <string>());
        }
Esempio n. 2
0
        public async Task Handler_ShouldReturnNotFound_WhenTagNotFound()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query = new GetActionsQuery(0);
                var dut   = new GetActionsQueryHandler(context);

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

                Assert.IsNotNull(result);
                Assert.AreEqual(ResultType.NotFound, result.ResultType);
                Assert.IsNull(result.Data);
            }
        }
Esempio n. 3
0
        public async Task Handler_ShouldReturnActionsInCorrectOrder()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher,
                                                         _currentUserProvider))
            {
                var query = new GetActionsQuery(_tag2Id);
                var dut   = new GetActionsQueryHandler(context);

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

                Assert.AreEqual(_openActionWithEarliestDueTime.Id, result.Data[0].Id);
                Assert.AreEqual(_openActionWithDueTime.Id, result.Data[1].Id);
                Assert.AreEqual(_openActionWithoutDueTime.Id, result.Data[2].Id);
                Assert.AreEqual(_closedActionWithEarliestDueTime.Id, result.Data[3].Id);
                Assert.AreEqual(_closedActionWithDueTime.Id, result.Data[4].Id);
                Assert.AreEqual(_closedActionWithoutDueTime.Id, result.Data[5].Id);
            }
        }
Esempio n. 4
0
        public async Task Handler_ShouldReturnActions()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query = new GetActionsQuery(_tagId);
                var dut   = new GetActionsQueryHandler(context);

                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 == _openActionId), _openAction);
                AssertAction(actionDtos.Single(a => a.Id == _closedActionId), _closedAction);
            }
        }