public void LoadEquipment_EquipmentHasSubscriber_ValidateUserAbleToLoadEquipment()
        {
            using (ShimsContext.Create())
            {
                // Given a user
                ShimCurrentUser.AsUserDto = () => new SIMPLTestContext().GetFakeUserDtoObject();

                // And a subscriber
                const string subId = "subId";

                // And the subscriber has a valid provisioned location
                const string locId = "locId";
                var location = new LocationDto {ID = locId};

                // And the location has a valid equipment
                const string equipId = "equipId";
                var equip = new EquipmentCollectionDto
                {
                    new EquipmentDto
                    {
                        AssociatedSubscriberId = subId,
                        LocationId = locId,
                        SerialNumber = equipId
                    }
                };

                var subscriber = new SubscriberDto
                {
                    ID = subId,
                    Accounts = new List<AccountDto>
                    {
                        new AccountDto
                        {
                            Location = location,
                            Equipment = equip
                        }
                    }
                };

                // When loading that equipment
                ShimRosettianClient.AllInstances.SearchSubscribersSearchFieldsDtoUserDto
                    = (myTestClient, mySearchCriteria, myUserDto) => new List<SubscriberDto> { subscriber };
                ShimRosettianClient.AllInstances.SearchLocationsSearchFieldsDtoUserDto =
                    (myTestClient, mySearchCriteria, myUserDto) => new LocationCollectionDto {location};

                var  actionResponse = SubscriberControllerForTests.LoadEquipment(equipId) as RedirectToRouteResult;

                // Then the user receives a response
                Assert.IsNotNull(actionResponse, "SubscriberController LoadEquipment method returned null");

                // And the response is successful
                // And the response redirects the route values correctly to subscriber index
                var jss = new JavaScriptSerializer();
                var expectedRouteValues = new RouteValueDictionary
                {
                    {"subID", subId},
                    {"devID", equipId},
                    {"action", "Index"},
                };
                var actualRouteValues = actionResponse.RouteValues;
                Assert.AreEqual(jss.Serialize(expectedRouteValues), jss.Serialize(actualRouteValues));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="locationId"></param>
        /// <returns></returns>
        public EquipmentCollectionDto GenerateEquipmentCollectionDto(string locationId)
        {
            var criteria = this.GenerateEquipmentCriteria(locationId);
            EquipmentCollectionDto equipColl = new EquipmentCollectionDto();
            equipColl.Add(new EquipmentDto());

            equipColl[0].HeadendCode = "01";
            equipColl[0].LocationId = locationId;
            equipColl[0].Status = criteria.Status;
            equipColl[0].SerialNumber = criteria.SerialNumber;
            EquipmentDto eDto = new EquipmentDto();
            eDto.HeadendCode = "01";
            eDto.LocationId = locationId;
            eDto.SerialNumber = criteria.SerialNumber;
            eDto.Status = criteria.Status;
            eDto.Type.Model = criteria.Model;

            using (var client = new RosettianClient())
            {
                var user = CurrentUser.AsUserDto();
                client.CreateEquipment(eDto, user);
            }
            return equipColl;
        }
        public void EditBlockedServicesMethod_SomeBlocked()
        {
            // Arrange
            PartialViewResult resultEditBlockedServices = null;
            string expectedServicesAsJSON = null;
            ServicesModel actualServicesModel = null;
            List<ServiceDto> expectedServiceList = null;
            ServiceCollectionDto actualServices = null;
            SubscriberDto expectedSubscriber = SIMPL.Test.IntegrationTest.Data.Data.GetSIMPLSubscriber04CPE01();
            Assert.IsNotNull(expectedSubscriber, "subscriber");
            Assert.IsNotNull(expectedSubscriber.ID, "subscriber.ID");

            EquipmentCollectionDto ec = new EquipmentCollectionDto();
            ec.Add(new EquipmentDto());
            ec[0].AssociatedSubscriberId = expectedSubscriber.ID;
            ec[0].BlockedServiceList.Add(new ServiceDto());
            ec[0].BlockedServiceList[0] = new ServiceDto
            {
                ClassName = ServiceClassType.ProvisionedOntDataPort.GetStringValue(),
                Name = "ENET",
                Description = "RJ-45 ETHERNET PORT"
            };

            expectedSubscriber.Accounts[0].Equipment = new EquipmentCollectionDto();
            expectedSubscriber.Accounts[0].Equipment.Add(ec[0]);

            EquipmentDto expectedDevice = expectedSubscriber.Accounts[0].Equipment.FirstOrDefault();
            Assert.IsNotNull(expectedDevice, "expectedDevice");

            expectedDevice.BlockedServiceList = new ServiceCollectionDto();
            expectedDevice.BlockedServiceList.AddRange(expectedSubscriber.Accounts[0].Services.GetRange(0, 2));

            using (RosettianClient client = new RosettianClient())
            {
                client.UpdateEquipment(expectedDevice, RosettianUser);
            }

            expectedServicesAsJSON = ServicesControllerHelper.ConvertServicesToJSON(expectedDevice.BlockedServiceList);
            Assert.IsNotNull(expectedServicesAsJSON, "expectedServicesAsJSON");

            // Act
            resultEditBlockedServices = ServicesControllerForTests.EditBlockedServices(expectedServicesAsJSON, expectedSubscriber.ID, expectedDevice.SerialNumber, "") as PartialViewResult;

            // Assert - First group
            Assert.IsNotNull(resultEditBlockedServices, "resultEditBlockedServices");

            // Arrange/Act - Second group
            actualServicesModel = resultEditBlockedServices.Model as ServicesModel;

            // Assert - Second group
            Assert.IsNotNull(actualServicesModel, "actualServicesModel");
            Assert.IsNull(actualServicesModel.ServicesActionResult, "ServicesActionResult is not null");
            Assert.AreEqual(expectedSubscriber.ID, actualServicesModel.SubscriberID, "Subscriber.ID compared to SubscriberID");
            Assert.AreEqual(3, actualServicesModel.SubscriberServicesList.Count, "actualServicesModel.SubscriberServicesList.Count");

            // Arrange/Act - Third group
            expectedServiceList = expectedSubscriber.Accounts[0].Services.OrderBy(x => x.Name).ToList();
            actualServices = ServicesControllerHelper.ConvertJSONToServices(actualServicesModel.ServicesAsJSON);

            // Assert - Third group
            int i = 0;
            foreach (ServiceDto individualService in actualServices)
            {
                Assert.AreEqual(expectedServiceList[i].Name, individualService.Name, "Service Name - index count {0}", i);
                Assert.AreEqual(expectedServiceList[i].Description, individualService.Description, "Service Description - index count {0}", i);
                Assert.AreEqual(expectedServiceList[i].ClassName, individualService.ClassName, "Service ClassName - index count {0}", i);
                i++;
            }

            // Assert - Third group (continued)
            string message = string.Empty;
            // Validate Blocked Services displayed matches the actualViewModel blocked services
            bool resultOfValidation = this.ValidateBlockedServices(expectedDevice.BlockedServiceList, actualServicesModel.BlockedServicesList, out message);
            Assert.IsTrue(resultOfValidation, message);
        }
        public void ToVideoDeviceList_EquipmentListHasOntAndAllTypesOfVideoDevices_ValidateAbleToMapEquipmentListToSerializableVideoDeviceList()
        {
            // Given a list of equipment
            var equipmentList = new EquipmentCollectionDto();

            // And the equipment list contains a ont port
            var ontPort = TestEquipment_ONTPort();
            equipmentList.Add(ontPort);

            // And the equipment list contains a dvr
            var dvr = TestEquipment_DVR();
            equipmentList.Add(dvr);

            // And the equipment list contains a cable card
            var cableCard = TestEquipment_CableCard();
            equipmentList.Add(cableCard);

            // And the equipment list contains a router
            var router = TestEquipment_Router();
            equipmentList.Add(router);

            // And the equipment list contains a non hd capable set top box
            var stb = TestEquipment_SetTopBox();
            equipmentList.Add(stb);

            // And the equipment list contains a digital adapter
            var da = TestEquipment_DigitalAdapter();
            equipmentList.Add(da);

            // And the equipment list contains a video access point
            var vap = TestEquipment_VideoAccessPoint();
            equipmentList.Add(vap);

            // And The equipment list contains a TiVo
            var tivo = TestEquipment_TiVo();
            equipmentList.Add(tivo);

            // When mapping the list equipment to serializable video device list
            var videoDeviceList = equipmentList.ToVideoDeviceList();

            // Then we receive a response
            Assert.IsNotNull(videoDeviceList);

            // And the response is successful
            // And the device count matches with the requested device list count
            Assert.AreEqual(equipmentList.Count, videoDeviceList.Count, "Device count does not match");

            // And the ont device id matches with the requested ont device id
            // And the ont model matches with the request ont model
            // And the ont device type mapped with type of ""
            var actualMappedOntPort = videoDeviceList.Where(x => x.Serial == ontPort.SerialNumber && x.Type=="" && x.Model==ontPort.Type.Model);
            Assert.IsTrue(actualMappedOntPort!=null && actualMappedOntPort.Count() == 1);

            // And the dvr id matches with the requested dvr id
            // And the dvr model matches with the requested dvr model
            // And the dvr mapped with type of DVR
            var actualMappedVideoDevice = videoDeviceList.Where(x => x.Serial == dvr.SerialNumber && x.Type=="DVR" && x.Model==dvr.Type.Model);
            Assert.IsTrue(actualMappedVideoDevice != null && actualMappedVideoDevice.Count() == 1);

            // And the cable card id matches with the requested cable card id
            // And the cable card model matches with the requested cable card model
            // And the cable card mapped with type of CC
            var actualMappedCableCard = videoDeviceList.Where(x => x.Serial == cableCard.SerialNumber && x.Type == "CC" && x.Model == cableCard.Type.Model);
            Assert.IsTrue(actualMappedCableCard != null && actualMappedCableCard.Count() == 1);

            // And the stb id matches with the requested router id
            // And the stb model matches with the requested stb model
            // And the stb mapped with type of SD
            var actualMappedStb= videoDeviceList.Where(x => x.Serial == stb.SerialNumber && x.Type.TrimEnd().EndsWith("SD") && x.Model == stb.Type.Model);
            Assert.IsTrue(actualMappedStb != null && actualMappedStb.Count() == 1);

            // And the digital adapter id matches with the requested router id
            // And the digital model matches with the requested digital model
            // And the digital adapter mapped with type of DA
            var actualMappedDigitalAdapter = videoDeviceList.Where(x => x.Serial == da.SerialNumber && x.Type == "DA" && x.Model == da.Type.Model);
            Assert.IsTrue(actualMappedDigitalAdapter != null && actualMappedDigitalAdapter.Count() == 1);

            // And the vap id matches with the requested router id
            // And the vap model matches with the requested digital model
            // And the vap mapped with type of VAP
            var actualMappedVap = videoDeviceList.Where(x => x.Serial == vap.SerialNumber && x.Type == "VAP" && x.Model == vap.Type.Model);
            Assert.IsTrue(actualMappedVap != null && actualMappedVap.Count() == 1);

            // And the TiVo id matches with the requested tivo id
            // And the TiVo model matches with the requested Tivo Model
            // And the TiVo mapped with type of Gateway
            var actualMappedTiVo = videoDeviceList.Where(x => x.Serial == tivo.SerialNumber && x.Type.ToUpper() == "TIVO" && x.Model.ToUpper() == "GATEWAY");
            Assert.IsTrue(actualMappedTiVo != null && actualMappedTiVo.Count() == 1, "TiVo did not map properly");
        }
Esempio n. 5
0
        public static SubscriberDto GetSIMPLSubscriber01()
        {
            //Location
            var loc = new LocationDto
            {
                ID = "5829224.3544318",
                AddressLine1 = "8105 161ST AVE NE",
                CityName = "REDMOND",
                StateName = "WA",
                ZipCode = "98052",
                HeadendCode = "04",
                CustomFields = DefaultCustomFields_Loc()
            };

            //Equipment
            const string unitAddr = "RDMDWAXAOL4-18-3-3";
            var equip = new EquipmentCollectionDto
            {
                NewEquipment("MRCC00181AB9D01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Data Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9M01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M MoCA Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P02", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P03", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P04", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("M90937ZA8275", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "QIP2500"), "0000050810829002", "ACTIVE")
            };
            equip.ToList().ForEach(x => x.LocationId = loc.ID);

            //Services
            var svcs = new ServiceCollectionDto
            {
                new ServiceDto { ClassName = "DATA - FTTH SPEED", Name = "F35M35M", Description = "35M DOWN 35M UP" },
                new ServiceDto{ ClassName = ServiceClassType.ProvisionedOntDataPort.GetStringValue(), Name = "MOCA", Description = "MOCA PORT" },
                new ServiceDto { ClassName = "RF - BASICS", Name = "FIOS", Description = "FIOS VIDEO SERVICE" },
                new ServiceDto { ClassName = "VIDEO - BUNDLE/MISC", Name = "FIDS1", Description = "DOWNSTREAM PATH" },
                new ServiceDto { ClassName = "VIDEO - BUNDLE/MISC", Name = "FIVOD", Description = "VIDEO ON DEMAND SERV" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIES1", Description = "FIOS TV ESSENTIALS" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIHDS", Description = "HIGH DEFINITION -TRK" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIPR1", Description = "FIOS TV PREMIER" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIPR5", Description = "FIOS TV PREM ENH BIZ" },
                new ServiceDto { ClassName = "VOICE", Name = "VOICE", Description = "FTTH VOICE SERVICE" },
            };

            //ServiceProfiles
            var vsps = new List<ServiceProfileDto>
            {
                NewVoiceServiceProfile("4258818771", 1, 413, "MRCC00181AB9P01", null),
                NewVoiceServiceProfile("4258699232", 1, 414, "MRCC00181AB9P02", null)
            };

            //Account
            var acct = new AccountDto
            {
                AcctContactEmail = null,
                AcctContactName = null,
                AcctContactPhone = null,
                Email = null,
                Location = loc,
                ID = null,
                Name = null,
                PIN = null,
                PinRequired = false,
                PPVCap = "1.00",
                PPVEnabled = true,
                PPVPrivilege = "2",
                PPVResetDay = "15",
                ServiceEnabled = true,
                ServiceProfiles = vsps,
                Services = svcs
            };

            var sub = new SubscriberDto
            {
                ID = "370002312079",
                Name = "KIKUYA JAPANESE RESTAURAN",
                SubContactEmail = "*****@*****.**",
                SubContactPhone = "4258818771",
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto{Label ="Service_ID", Value=""},
                    new CustomFieldDto{Label = "PCAN", Value="F274112844"},
                    new CustomFieldDto{Label = "IP_TYPE", Value="DYNAMIC"},
                    new CustomFieldDto{Label = "Sub_WTN", Value=""},
                },
                Accounts = new List<AccountDto> { acct }
            };
            return sub;
        }
Esempio n. 6
0
        /// <summary>
        /// NewEquipmentCollection - provides a new EquipmentCollectionDto 
        /// </summary>
        /// <param name="collectionSize"></param>
        /// <returns></returns>
        public static EquipmentCollectionDto NewEquipmentCollection(int collectionSize = 0)
        {
            var equipCollection = new EquipmentCollectionDto();
            var rand = new Random();
            if (collectionSize <= 0)
            {
                collectionSize = rand.Next(4, 12);
            }

            var equipmentCategories = Enum.GetValues(typeof (EquipmentCategoryDto));

            for (var i = 0; i < collectionSize; i++)
            {
                var category = (EquipmentCategoryDto) equipmentCategories.GetValue(rand.Next(equipmentCategories.Length));

                // currently, no items exist for these categories so they must be excluded: ONT, ONTVdslPort, Modem
                while (category == EquipmentCategoryDto.ONT ||
                    category == EquipmentCategoryDto.ONTVdslPort ||
                    category == EquipmentCategoryDto.Modem ||
                    category == EquipmentCategoryDto.UnKnown ||
                    category == EquipmentCategoryDto.None)
                {
                    category = (EquipmentCategoryDto)equipmentCategories.GetValue(rand.Next(equipmentCategories.Length));
                }

                equipCollection.Add(NewEquipment(category));
            }

            return equipCollection;
        }