public async Task GetActionsReturnsListOfActions() { // Arrange using (var mockContext = new MockHttpContext()) { this.controller.ControllerContext.HttpContext = mockContext.Object; var config = new ServicesConfig(); var action = new EmailActionSettings(this.mockResourceManagementClient.Object, config, this.mockLogger.Object); var actionsList = new List <IActionSettings> { action }; this.mockActions .Setup(x => x.GetListAsync()) .ReturnsAsync(actionsList); // Act var result = await this.controller.GetActionsSettingsAsync(); // Assert this.mockActions.Verify(x => x.GetListAsync(), Times.Once); Assert.NotEmpty(result.Items); Assert.Equal(actionsList.Count, result.Items.Count); } }
public async Task <List <IActionSettings> > GetListAsync() { var result = new List <IActionSettings>(); // Add Email Action Settings var emailActionSettings = new EmailActionSettings( this.resourceManagerClient, this.servicesConfig, this.log); await emailActionSettings.InitializeAsync(); result.Add(emailActionSettings); return(result); }