コード例 #1
0
        public async Task Handle_ShouldReturnOkResult()
        {
            using (new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new GetMcPkgsUnderCommPkgInProjectQueryHandler(_mcPkgApiServiceMock.Object, _plantProvider);
                var result = await dut.Handle(_query, default);

                Assert.AreEqual(ResultType.Ok, result.ResultType);
            }
        }
コード例 #2
0
        public async Task Handle_ShouldReturnEmptyList_WhenSearchReturnsNull()
        {
            using (new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut = new GetMcPkgsUnderCommPkgInProjectQueryHandler(_mcPkgApiServiceMock.Object, _plantProvider);
                _mcPkgApiServiceMock
                .Setup(x => x.GetMcPkgsByCommPkgNoAndProjectNameAsync(TestPlant, _projectName, _commPkgNo))
                .Returns(Task.FromResult <IList <ProCoSysMcPkg> >(null));

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

                Assert.AreEqual(ResultType.Ok, result.ResultType);
                Assert.AreEqual(0, result.Data.Count);
            }
        }
コード例 #3
0
        public async Task Handle_ShouldReturnCorrectItems()
        {
            using (new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new GetMcPkgsUnderCommPkgInProjectQueryHandler(_mcPkgApiServiceMock.Object, _plantProvider);
                var result = await dut.Handle(_query, default);

                Assert.AreEqual(3, result.Data.Count);
                var item1 = result.Data.ElementAt(0);
                var item2 = result.Data.ElementAt(1);
                var item3 = result.Data.ElementAt(2);
                AssertMcPkgData(_mainApiMcPkgs.Single(c => c.McPkgNo == item1.McPkgNo), item1);
                AssertMcPkgData(_mainApiMcPkgs.Single(t => t.McPkgNo == item2.McPkgNo), item2);
                AssertMcPkgData(_mainApiMcPkgs.Single(t => t.McPkgNo == item3.McPkgNo), item3);
            }
        }