private void RegisterTestApplication(IFoghornService service) { var notificationTypeDtos = new List <NotificationTypeDto>(); for (var i = 0; i < NumNotificationTypes; i++) { var notificationTypeDto = new NotificationTypeDto { NotificationTypeName = NotificationName + i, NotificationTypeDisplayName = "Test Notfication " + i }; try { var iconFilePath = string.Format(@"..\..\NotificationIcons\{0}{1}.png", NotificationName, i); var iconFile = File.OpenRead(iconFilePath); var iconBuffer = new byte[iconFile.Length]; iconFile.Read(iconBuffer, 0, (int)iconFile.Length); notificationTypeDto.NotificationTypeIcon = iconBuffer; } catch (Exception exception) { Logger.LogException(LogLevel.Error, FailureMessage, exception); throw; } notificationTypeDtos.Add(notificationTypeDto); } var sendingApplicationDto = new SendingApplicationDto { SendingApplicationName = ApplicationTestName }; try { var iconFilePath = string.Format(@"..\..\NotificationIcons\Icon.png"); var iconFile = File.OpenRead(iconFilePath); var iconBuffer = new byte[iconFile.Length]; iconFile.Read(iconBuffer, 0, (int)iconFile.Length); sendingApplicationDto.SendingApplicationIcon = iconBuffer; } catch (Exception exception) { Logger.LogException(LogLevel.Error, FailureMessage, exception); throw; } _testApplicationId = service.RegisterSendingApplication(sendingApplicationDto, notificationTypeDtos); }
private void RegisterTestApplication(IFoghornService service) { var notificationTypeDtos = new List<NotificationTypeDto>(); for (var i = 0; i < NumNotificationTypes; i++) { var notificationTypeDto = new NotificationTypeDto { NotificationTypeName = NotificationName + i, NotificationTypeDisplayName = "Test Notfication " + i }; try { var iconFilePath = string.Format(@"..\..\NotificationIcons\{0}{1}.png", NotificationName, i); var iconFile = File.OpenRead(iconFilePath); var iconBuffer = new byte[iconFile.Length]; iconFile.Read(iconBuffer, 0, (int) iconFile.Length); notificationTypeDto.NotificationTypeIcon = iconBuffer; } catch (Exception exception) { Logger.LogException(LogLevel.Error, FailureMessage, exception); throw; } notificationTypeDtos.Add(notificationTypeDto); } var sendingApplicationDto = new SendingApplicationDto {SendingApplicationName = ApplicationTestName}; try { var iconFilePath = string.Format(@"..\..\NotificationIcons\Icon.png"); var iconFile = File.OpenRead(iconFilePath); var iconBuffer = new byte[iconFile.Length]; iconFile.Read(iconBuffer, 0, (int) iconFile.Length); sendingApplicationDto.SendingApplicationIcon = iconBuffer; } catch (Exception exception) { Logger.LogException(LogLevel.Error, FailureMessage, exception); throw; } _testApplicationId = service.RegisterSendingApplication(sendingApplicationDto, notificationTypeDtos); }