Esempio n. 1
0
        public async Task HandleGetUniqueTagModesQuery_ShouldReturnCorrectUniqueModes()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut = new GetUniqueTagModesQueryHandler(context);

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

                Assert.AreEqual(1, result.Data.Count);
                Assert.IsTrue(result.Data.Any(rt => rt.Title == _testDataSet.Mode1.Title));

                result = await dut.Handle(new GetUniqueTagModesQuery(_testDataSet.Project2.Name), default);

                Assert.AreEqual(1, result.Data.Count);
                Assert.IsTrue(result.Data.Any(rt => rt.Title == _testDataSet.Mode1.Title));
            }
        }
Esempio n. 2
0
        public async Task HandleGetUniqueTagModesQuery_ShouldReturnOkResult()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new GetUniqueTagModesQueryHandler(context);
                var result = await dut.Handle(_queryForProject1, default);

                Assert.AreEqual(ResultType.Ok, result.ResultType);
            }
        }
Esempio n. 3
0
        public async Task HandleGetUniqueTagModesQuery_ShouldReturnEmptyListOfUniqueModes()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher,
                                                         _currentUserProvider))
            {
                var dut = new GetUniqueTagModesQueryHandler(context);

                var result = await dut.Handle(new GetUniqueTagModesQuery("Unknown"), default);

                Assert.AreEqual(0, result.Data.Count);
            }
        }