Exemplo n.º 1
0
        public void ProductEventsSenderAll_EventIsTopBuy_CanSend()
        {
            var eventHubSender = new Mock <IEventHubSender>();

            eventHubSender.Setup(x => x.Send(It.IsAny <EventData>()));
            var sender = new ProductEventSender(eventHubSender.Object, new List <string> {
            });

            var result = sender.CanSend(new ProductEvent {
                CountryId = "AS"
            });

            Assert.IsTrue(result);
        }
Exemplo n.º 2
0
        public void ProductEventsSenderTAAndOO_EventIsAS_NotSend()
        {
            var eventHubSender = new Mock <IEventHubSender>();

            eventHubSender.Setup(x => x.Send(It.IsAny <EventData>()));
            var sender = new ProductEventSender(eventHubSender.Object, new List <string> {
                "TA", "OO"
            });

            var result = sender.CanSend(new ProductEvent {
                CountryId = "AS"
            });

            Assert.IsFalse(result);
        }
Exemplo n.º 3
0
        public void ProductEventSender_SendReconciliationEvent_AddedParameterToEvent()
        {
            var saleId      = new Guid("3832896B-3CF1-4B78-BAF8-22DBEA26B633");
            var itemId      = new Guid("D0E8C5CB-E787-4B83-97FC-67C5A9AF6880");
            var countryId   = "TA";
            var productKey  = $"{itemId}_{saleId}_{countryId}";
            var sendedEvent = new EventData();

            var productEvent = new ProductEvent {
                Id = productKey, EventAction = EventAction.Updated
            };

            var EventHubSender = new Mock <IEventHubSender>();

            EventHubSender.Setup(x => x.Send(It.IsAny <EventData>())).Callback((EventData _eventData) => { sendedEvent = _eventData; });

            var sender = new ProductEventSender(EventHubSender.Object, new List <string> {
                "TA"
            });

            sender.SendRefeedEvent(productEvent);

            Assert.IsTrue(sendedEvent.Properties.Keys.Contains("EventType"));
        }