Exemplo n.º 1
0
        public async Task GetAllPipelines()
        {
            var pipelines = new List <NotificationPipelineReadModel>();

            Mock <INotificationEngine> notificationEngineMock = new Mock <INotificationEngine>(MockBehavior.Strict);

            notificationEngineMock.Setup(x => x.GetPipelines()).ReturnsAsync(pipelines).Verifiable();

            var controller = new NotificationsController(
                notificationEngineMock.Object, Mock.Of <IMediator>(MockBehavior.Strict),
                Mock.Of <ILogger <NotificationsController> >());

            var actionResult = await controller.GetAllPipelines();

            var result = actionResult.EnsureOkObjectResult <IEnumerable <NotificationPipelineReadModel> >(true);

            Assert.Equal(pipelines, result);

            notificationEngineMock.Verify();
        }