コード例 #1
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());
        }
        public void Handle_ShouldAddIpoCompletedHistoryRecord()
        {
            // Arrange
            Assert.IsNull(_historyAdded);

            // Act
            var objectGuid = Guid.NewGuid();
            var plant      = "TestPlant";

            _dut.Handle(new IpoCompletedEvent(plant, objectGuid), default);

            // Assert
            Assert.IsNotNull(_historyAdded);
            Assert.AreEqual(plant, _historyAdded.Plant);
            Assert.AreEqual(objectGuid, _historyAdded.ObjectGuid);
            Assert.IsNotNull(_historyAdded.Description);
            Assert.AreEqual(EventType.IpoCompleted, _historyAdded.EventType);
            Assert.AreEqual("IPO", _historyAdded.ObjectType);
        }