public void ChangeColorTest() { var channels = new[] { SubscriptionChannel.Email, SubscriptionChannel.Sms, SubscriptionChannel.Http }; foreach (var channel in channels) { // Создадим пользователя var account = TestHelper.GetTestAccount(); var user = TestHelper.CreateTestUser(account.Id); var dispatcher = TestHelper.GetDispatcherClient(); // Создадим тип компонента var componentType = TestHelper.CreateRandomComponentType(account.Id); // Настроим подписку по умолчанию и подписку на тип var response1 = dispatcher.CreateSubscription(account.Id, new CreateSubscriptionRequestData() { UserId = user.Id, Object = SubscriptionObject.Default, Channel = channel }); var data1 = response1.Data; var response2 = dispatcher.UpdateSubscription(account.Id, new UpdateSubscriptionRequestData() { Id = data1.Id, IsEnabled = true, Importance = EventImportance.Warning }); response2.Check(); var response3 = dispatcher.CreateSubscription(account.Id, new CreateSubscriptionRequestData() { UserId = user.Id, Object = SubscriptionObject.ComponentType, ComponentTypeId = componentType.Id, Channel = channel }); var data3 = response3.Data; var response4 = dispatcher.UpdateSubscription(account.Id, new UpdateSubscriptionRequestData() { Id = data3.Id, IsEnabled = true, Importance = EventImportance.Warning }); response4.Check(); // Поменяем цвет подписок на красный using (var controller = new SubscriptionsController(account.Id, user.Id)) { controller.Color(data1.Id + "," + data3.Id, ObjectColor.Red.ToString(), user.Id, channel); } // Проверим, что цвет подписок стал красным var response5 = dispatcher.CreateSubscription(account.Id, new CreateSubscriptionRequestData() { UserId = user.Id, Object = SubscriptionObject.Default, Channel = channel }); var data5 = response5.Data; Assert.Equal(EventImportance.Alarm, data5.Importance); var response6 = dispatcher.CreateSubscription(account.Id, new CreateSubscriptionRequestData() { UserId = user.Id, ComponentTypeId = componentType.Id, Object = SubscriptionObject.ComponentType, Channel = channel }); var data6 = response6.Data; Assert.Equal(EventImportance.Alarm, data6.Importance); } }