コード例 #1
0
        public void Ensure_all_properties_are_mapped(
            [Frozen] Mock <IPostOfficeDocumentFactorySettings> settings,
            ChangeOfChargesMessage changeOfChargesMessage,
            MarketParticipant marketParticipant,
            PostOfficeDocumentFactory sut)
        {
            // Arrange
            settings.Setup(x => x.GetHubMRid()).Returns("MRidFromSettings");
            MakeMessageValid(changeOfChargesMessage);
            var receivers = new List <MarketParticipant> {
                marketParticipant
            };

            // Act
            var actual = sut.Create(receivers, changeOfChargesMessage)
                         .ToList();

            // Assert
            actual.ForEach(d => d.Should().NotContainNullsOrEmptyEnumerables());
        }
コード例 #2
0
        public void Ensure_all_types_of_MarketParticipantRole_are_handled_by_Create(
            PostOfficeDocumentFactory sut,
            ChangeOfChargesMessage changeOfChargesMessage,
            MarketParticipant marketParticipant)
        {
            // Arrange
            MakeMessageValid(changeOfChargesMessage);
            var receivers = new List <MarketParticipant> {
                marketParticipant
            };
            var roles = Enum.GetValues(typeof(MarketParticipantRole)).Cast <MarketParticipantRole>();

            foreach (var role in roles)
            {
                changeOfChargesMessage.MarketDocument !.SenderMarketParticipant !.Role = role;

                // Act & Assert
                // Create throws a NotImplemented exception if a value in MarketParticipantRole is not handled.
                _ = sut.Create(receivers, changeOfChargesMessage).ToList();
            }
        }