public async Task CreateServiceStatusLogTestAsync() { // Arrange using (var businessObject = BusinessObjectMocker.GetAdministrationBusinessObject()) { var logger = LoggerMocker.GetLogger <IAdministrationBusinessObject>(); var controller = new AdministrationController(logger, businessObject); var viewModel = new ServiceEnvironmentStatusLogVm { ServiceEnvironmentID = 1, Target = "192.168.1.1", ActionName = "Ping", Success = true, Date = DateTime.Now }; // Act var response = await controller.CreateServiceStatusLogAsync(viewModel) as ObjectResult; // Assert var value = response.Value as ISingleViewModelResponse <ServiceEnvironmentStatusLog>; Assert.False(value.DidError); } }
public static IDashboardBusinessObject GetDashboardBusinessObject() { var logger = LoggerMocker.GetLogger <IDashboardBusinessObject>(); var appSettings = Options.Create(new AppSettings { ConnectionString = ConnectionString }); return(new DashboardBusinessObject(logger, new ServiceMonitorDbContext(appSettings, new ServiceMonitorEntityMapper() as IEntityMapper))); }
public async Task GetServiceWatcherItemsTestAsync() { // Arrange var logger = LoggerMocker.GetLogger <IDashboardBusinessObject>(); var businessObject = BusinessObjectMocker.GetDashboardBusinessObject(); var controller = new DashboardController(logger, businessObject); // Act var response = await controller.GetServiceWatcherItemsAsync() as ObjectResult; // Assert var value = response.Value as IListViewModelResponse <ServiceWatcherItemDto>; Assert.False(value.DidError); }
public async Task GetServiceStatusDetailsTestAsync() { // Arrange var logger = LoggerMocker.GetLogger <IDashboardBusinessObject>(); var businessObject = BusinessObjectMocker.GetDashboardBusinessObject(); var controller = new DashboardController(logger, businessObject); var userName = "******"; // Act var response = await controller.GetServiceStatusDetailsAsync(userName) as ObjectResult; // Assert var value = response.Value as IListViewModelResponse <ServiceStatusDetailDto>; Assert.False(value.DidError); }