コード例 #1
0
 public CompositeSubscriber()
 {
     SubscriberDpi = new CustomerAccountDto();
     SubscriberTriad = new SubscriberDto();
     DpiServices = new List<ServiceAccountDto>();
     SubscriberErrorMessages = string.Empty;
 }
コード例 #2
0
        public void User_can_load_a_subscriber_that_is_billed_but_not_provisioned()
        {
            using (ShimsContext.Create())
            {
                // Setup
                const string subscriberID = "999999999999";
                string deviceID = null;
                const string state = "";
                const string region = "PA";
                const string subscriberName = "Billed Subscriber";
                const string expectedTN = "5551231234";

                var myContext = new SIMPLTestContext();

                // Given a user
                var fakeUserDto = myContext.GetFakeUserDtoObject();
                ShimCurrentUser.AsUserDto = () => fakeUserDto;
                ShimRosettianClient.AllInstances.LoadSubscriberStringUserDto = delegate
                {
                    return new SubscriberDto();
                };
                ShimRosettianClient.AllInstances.LoadSubscriberPhonesStringUserDto = delegate
                {
                    return new List<PhoneDto>();
                };
                ShimEnterpriseClient.AllInstances.GetBillingServiceAccountsStringHeaderArgs = delegate
                {
                    var billingAccount = new BillingandServiceAccountDto();
                    billingAccount.ServiceAccounts = new List<ServiceAccountDto>();
                    var customerAccount = new CustomerAccountDto();
                    var customer = new CustomerDto();
                    customer.ContactName = subscriberName;
                    customerAccount.Customer = customer;
                    billingAccount.CustomerAccount = customerAccount;
                    var serviceAccountDto = new ServiceAccountDto
                    {
                        SubscriberName = subscriberName,
                        TN = expectedTN,
                        USI = subscriberID,
                    };
                    billingAccount.ServiceAccounts.Add(serviceAccountDto);
                    return billingAccount;
                };
                ShimCurrentSubscriber.SetInstanceCompositeSubscriberSubscriberModel = (myCompositeSubscriber, mySubscriberModel) => { };
                ShimCurrentSubscriber.GetInstance = () => new ShimCurrentSubscriber
                {
                    ProvisionedServicesListGet = () => new List<ServiceDto>()
                };
                // When loading that subscriber
                var result = SubscriberControllerForTests.Index(subscriberID, deviceID, state, region) as ViewResult;

                //Then the user receives a successful response
                Assert.IsNotNull(result, "SubscriberController Index method returned null");
                Assert.IsNotNull(result.Model, "result.Model method returned null");
                var testSubscriberModel = result.Model as SubscriberModel;

                Assert.IsNotNull(testSubscriberModel, "Subscriber Model returned null");
                Assert.AreEqual("200", testSubscriberModel.ActionResponse.Code, "Test threw an exception {0}{0}{1}", Environment.NewLine, testSubscriberModel.ActionResponse.Message);

                var subDetials = testSubscriberModel.SubDetailsModel;
                Assert.AreEqual(subscriberID, subDetials.USI, string.Format("Billing USI not used: Actual-{0}, Expected-{1}", subDetials.USI, subscriberID));
                Assert.AreEqual(subscriberName, subDetials.DisplayedName, string.Format("Billing Subscriber Name not used: Actual-{0}, Expected-{1}", subDetials.DisplayedName, subscriberName));
                Assert.AreEqual(region, subDetials.BillingRegion, string.Format("Billing Region is incorrect: Actual-{0}, Expected-{1}", subDetials.BillingRegion, region));
                Assert.AreEqual(expectedTN, subDetials.WTN, "WTN do not match billing TN");
            }
        }