public async Task EventController_AddOrUpdate_WithListOfEvent_CallsProcessor()
        {
            var evt = new Event
            {
                callID      = "ID",
                callDetails = new CallDetails
                {
                    isConnected = "Y"
                }
            };

            var list = new List <Event> {
                evt
            };
            var expectedNum = 1;

            ProcessorMock.Setup(x => x.AddOrUpdate(list)).Returns(Task.FromResult(expectedNum));

            var response = await ClassUnderTest.AddOrUpdate(list);

            ProcessorMock.Verify(x => x.AddOrUpdate(list), Times.Once());
            var content = Assert.IsType <OkNegotiatedContentResult <SuccessResponse> >(response).Content;

            Assert.Equal(content.CountProcessed, expectedNum);
        }
Exemplo n.º 2
0
        public async Task EventProcessor_AddOrUpdate_GetsDataTableAndPassesToRepository()
        {
            var list = new List <Event> {
                new Event()
            };
            var entitiesList = new List <EventEntity>();

            TransformHelperMock.Setup(x => x.Transform(list)).Returns(entitiesList).Verifiable();

            await ClassUnderTest.AddOrUpdate(list);

            TransformHelperMock.Verify();
            EventRepoMock.Verify(x => x.AddOrUpdateAsync(entitiesList), Times.Once());
        }