Exemplo n.º 1
0
        public async Task Handle_ShouldSendEmail()
        {
            // Arrange
            var objectGuid = Guid.NewGuid();
            var plant      = "TestPlant";
            var commpkgs   = new List <CommPkg>
            {
                new CommPkg(plant, "project", "commpkgno", "description", "status", "system|subsystem")
            };
            var invitation = new Invitation(plant, "project", "title", "description", DisciplineType.MDP, DateTime.Now,
                                            DateTime.Now, "location", null, commpkgs);

            invitation.AddParticipant(new Participant(plant, Organization.ConstructionCompany,
                                                      IpoParticipantType.Person, "code", "firstname", "lastname", "username", "email", Guid.NewGuid(), 1));
            var emails = new List <string>()
            {
                "*****@*****.**", "*****@*****.**"
            };
            var ipoCompletedEvent = new IpoCompletedEvent(plant, objectGuid, invitation.Id, invitation.Title, emails);

            // Act
            await _dut.Handle(ipoCompletedEvent, default);

            // Assert
            _emailServiceMock.Verify(
                t => t.SendEmailsAsync(It.IsAny <List <string> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()),
                Times.Once());
        }
Exemplo n.º 2
0
        public async Task Handle_ShouldSendBusTopic()
        {
            // Arrange
            var objectGuid = Guid.NewGuid();
            var plant      = "TestPlant";
            var emails     = new List <string> {
                "*****@*****.**", "*****@*****.**"
            };
            var ipoCompletedEvent = new IpoCompletedEvent(plant, objectGuid, 1234, "Invitation title", emails);

            // Act
            await _dut.Handle(ipoCompletedEvent, default);

            // Assert
            _topicClient.Verify(t => t.SendAsync(It.IsAny <Message>()), Times.Once());
        }