/// <summary> /// RestoreSubscriber1 - calls either Rosettian CreateSubscriber or UpdateSubscriber /// </summary> /// <param name="sub"></param> /// <param name="requiresUpdates"></param> public static void RestoreSubscriber1(SubscriberDto sub, bool requiresUpdates) { using (var client = new RosettianClient()) { if (!client.SubscriberExists(sub.ID, user)) { client.CreateSubscriber(sub, user); } else if (requiresUpdates) { client.UpdateSubscriber(sub, true, user); } } }
public void When_editing_subscriber_provisioning_information_the_services_are_not_changed() { // Given a user // And a known subscriber // And the subscriber is billed // And the subscriber is provisioned const string testUSI = "370100037230"; // Field IT Test account var subscriber = BusinessFacadeforTests.LoadCompositeSubscriber(testUSI, "WA", RosettianUser); Assert.IsNotNull(subscriber, "Loaded subscriber is null."); Assert.IsNotNull(subscriber.SubscriberDpi, "The LoadCompositeSubscriber call did not bring back any DPI-related data. Check the settings in the App.config file to verify that you are using the correct endpoints"); // And the subscriber has provisioned services var originalSubscriberServices = subscriber.SubscriberTriad.Accounts[0].Services; // And the cbr needs to be changed on the provisioned account var model = subscriber.MapToSubscriberModel(); var originalCBR = model.SubDetailsModel.CBR; CurrentSubscriber.SetInstance(subscriber, model); model.SubDetailsModel.CBR = "2189123456"; // When editing the subscriber var actualResult = SubscriberControllerForTests.UpdateSubscriber(model.SubDetailsModel) as JsonResult; // Then the user receives a response Assert.IsNotNull(actualResult, "The result from the update subscriber was null"); // And the response is successful var expectedJson = new { status = "valid", returnedPartial = "" }.ToJSON(); Assert.AreEqual(expectedJson, actualResult.Data.ToJSON()); // And the subscriber cbr is modified var updateSubscriber = BusinessFacadeforTests.LoadCompositeSubscriber(testUSI, "WA", RosettianUser); Assert.IsNotNull(updateSubscriber.SubscriberDpi, "The LoadCompositeSubscriber call did not bring back any DPI-related data. Check the settings in the App.config file to verify that you are using the correct endpoints"); Assert.AreEqual("2189123456", updateSubscriber.SubscriberTriad.SubContactPhone, "The CBR was not updated."); // And the provisioned services remain unchanged var newServices = updateSubscriber.SubscriberTriad.Accounts[0].Services; Assert.IsTrue(newServices.SequenceEqual(originalSubscriberServices, new ServiceComparer()), "The service list is not the same"); //Cleanup subscriber.SubscriberTriad.SubContactPhone = originalCBR; try { using (var client = new RosettianClient()) { client.UpdateSubscriber(subscriber.SubscriberTriad, true, CurrentUser.AsUserDto()); } } catch (System.Exception ex) { var exceptionHelper = new ExceptionHelper(); Assert.Fail(exceptionHelper.GetAllInnerExceptionMessagesAndStackTraceForTests(ex)); } }
/// <summary> /// RestoreSubscriber - returns SubscriberDto - calls either Rosettian CreateSubscriber or UpdateSubscriber /// </summary> /// <param name="sub"></param> /// <returns></returns> protected static SubscriberDto RestoreSubscriber(SubscriberDto sub) { using (var client = new RosettianClient()) { if (!client.SubscriberExists(sub.ID, user)) { if (sub.Accounts != null && sub.Accounts.Count > 1 && sub.Accounts[0].ServiceEnabled == true) { sub.Accounts[0].ServiceEnabled = false; } client.CreateSubscriber(sub, user); } else { client.UpdateSubscriber(sub, true, user); } if (sub.Accounts != null && sub.Accounts.Count > 0) { var serviceProfiles = sub.Accounts[0].ServiceProfiles; if (serviceProfiles != null && serviceProfiles.Count > 0) { var expectedPhones = ((VoiceServiceProfileDto)serviceProfiles[0]).PhoneLines; RestorePhone(sub.ID, expectedPhones); } } return sub; } }