public void Constructor_SetsProperties()
        {
            var dut = new GetInvitationsByCommPkgNoQuery("CommPkgNo", "ProjectName");

            Assert.AreEqual("CommPkgNo", dut.CommPkgNo);
            Assert.AreEqual("ProjectName", dut.ProjectName);
        }
        public async Task HandleGetInvitationsByCommPkgNoQuery_ShouldReturnOkResult()
        {
            using (var context = new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query  = new GetInvitationsByCommPkgNoQuery(_commPkgNo, _projectName);
                var dut    = new GetInvitationsByCommPkgNoQueryHandler(context);
                var result = await dut.Handle(query, default);

                Assert.AreEqual(ResultType.Ok, result.ResultType);
            }
        }
示例#3
0
        public async Task ValidateAsync_OnGetInvitationsByCommPkgNoQuery_ShouldReturnFalse_WhenNoAccessToProject()
        {
            // Arrange
            var query = new GetInvitationsByCommPkgNoQuery("commpkg", _projectWithoutAccess);

            // act
            var result = await _dut.ValidateAsync(query);

            // Assert
            Assert.IsFalse(result);
        }
        public async Task HandleGetInvitationsByCommPkgNoQuery_ShouldReturnCorrectInvitations()
        {
            using (var context = new IPOContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var query = new GetInvitationsByCommPkgNoQuery(_commPkgNo, _projectName);
                var dut   = new GetInvitationsByCommPkgNoQueryHandler(context);

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

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

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

                AssertInvitation(invitationDtos.Single(i => i.Id == _dpInvitationId), _dpInvitation);
                AssertInvitation(invitationDtos.Single(i => i.Id == _mdpInvitationId), _mdpInvitation);
            }
        }