public void PermittingViewHierarchicalSecondaryRepeaterItemsSetValue()
        {
            CS_View_EquipmentInfo dataItem = new CS_View_EquipmentInfo()
            {
                Active = true,
                ComboID = 1,
                ComboName = "FTW-1",
                JobStatus = "Combo1",
                Descriptor = null,
                DivisionID = 1,
                DivisionName = "One",
                DivisionState = "TX",
                EquipmentID = 1,
                EquipmentStatus = "Up",
                IsPrimary = 1,
                JobID = 1,
                JobLocation = "TX",
                JobNumber = "000001",
                Status = "Reserved",
                Type = "Type1",
                UnitNumber = "NumberOne"
            };

            CS_View_EquipmentInfo dataItem2 = new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 1,
                    ComboName = "FTW-1",
                    JobStatus = "Combo1",
                    Descriptor = null,
                    DivisionID = 1,
                    DivisionName = "One",
                    DivisionState = "TX",
                    EquipmentID = 2,
                    EquipmentStatus = "Down",
                    IsPrimary = 0,
                    JobID = 1,
                    JobLocation = "TX",
                    JobNumber = "000001",
                    Status = "Reserved",
                    Type = "Type1",
                    UnitNumber = "NumberTwo"
                };

            //TODO
            Mock<IPermittingView> mock = new Mock<IPermittingView>();
            mock.SetupProperty(c => c.FirstTierDataItem, dataItem);
            mock.SetupProperty(c => c.SecondTierDataItem, dataItem2);
            mock.SetupProperty(c => c.SecondTierUnitNumber, "");
            mock.SetupProperty(c => c.SecondTierJobId, 0);
            mock.SetupProperty(c => c.SecondTierJobNumber, "");
            mock.SetupProperty(c => c.SecondTierDivisionNumber, "");
            mock.SetupProperty(c => c.SecondTierDivisionState, "");

            PermittingViewModel viewModel = new PermittingViewModel(mock.Object);
            viewModel.SetDetailedEquipmentComboRowData();

            Assert.AreEqual("NumberTwo", mock.Object.SecondTierUnitNumber);
            Assert.AreEqual(1, mock.Object.SecondTierJobId);
            Assert.AreEqual("000001", mock.Object.SecondTierJobNumber);
            Assert.AreEqual("One", mock.Object.SecondTierDivisionNumber);
            Assert.AreEqual("TX", mock.Object.SecondTierDivisionState);
        }
        public void IsSetEquipmentsAddRowDataFillingRowProperties()
        {
            // Arrange
            CS_View_EquipmentInfo equipmentInfo = new CS_View_EquipmentInfo()
            {
                Active = true,
                CallLogID = 123,
                ComboID = 123,
                ComboName = "Combo 123",
                JobStatus = "A - Acive",
                Descriptor = "Hazmat",
                DivisionID = 1,
                DivisionName = "001",
                DivisionState = "TX",
                EquipmentID = 1,
                EquipmentStatus = "Up",
                IsPrimary = 1,
                JobID = 123,
                JobLocation = "Denton, TX",
                JobNumber = "000123",
                Status = "Available",
                Type = "ATA",
                UnitNumber = "0001",
                PrefixedNumber = "PA000123"
            };

            Mock<IResourceAllocationView> mock = new Mock<IResourceAllocationView>();
            mock.SetupProperty(c => c.EquipmentRowDataItem, equipmentInfo);
            mock.SetupProperty(c => c.SelectedEquipmentAddList, new Dictionary<string, bool>());
            mock.SetupProperty(c => c.EquipmentsAddDivision, "");
            mock.SetupProperty(c => c.EquipmentsAddDivisionState, "");
            mock.SetupProperty(c => c.EquipmentsAddComboName, "");
            mock.SetupProperty(c => c.EquipmentsAddUnitNumber, "");
            mock.SetupProperty(c => c.EquipmentsAddDescriptor, "");
            mock.SetupProperty(c => c.EquipmentsAddStatus, "");
            mock.SetupProperty(c => c.EquipmentsAddJobLocation, "");
            mock.SetupProperty(c => c.EquipmentsAddType, "");
            mock.SetupProperty(c => c.EquipmentsAddOperationStatus, "");
            mock.SetupProperty(c => c.EquipmentsAddJobNumber, "");
            mock.SetupProperty(c => c.EquipmentsAddchkEquipmentAdd, false);
            mock.SetupProperty(c => c.EquipmentsAddEquipmentId, "");
            mock.SetupProperty(c => c.EquipmentsAddIsCombo, "");
            mock.SetupProperty(c => c.EquipmentsAddIsComboUnit, "");
            mock.SetupProperty(c => c.EquipmentsAddJobNumberNavigateUrl, "");
            mock.SetupProperty(c => c.EquipmentsAddTypeNavigateUrl, "");
            mock.SetupProperty(c => c.EquipmentsAddComboID, null);

            // Act
            ResourceAllocationViewModel viewModel = new ResourceAllocationViewModel(mock.Object);
            viewModel.SetEquipmentsAddRow();

            // Assert
            Assert.AreEqual("001", mock.Object.EquipmentsAddDivision, "Failed in EquipmentsAddDivision");
            Assert.AreEqual("TX", mock.Object.EquipmentsAddDivisionState, "Failed in EquipmentsAddDivisionState");
            Assert.AreEqual("Combo 123", mock.Object.EquipmentsAddComboName, "Failed in EquipmentsAddComboName");
            Assert.AreEqual("0001", mock.Object.EquipmentsAddUnitNumber, "Failed in EquipmentsAddUnitNumber");
            Assert.AreEqual("Hazmat", mock.Object.EquipmentsAddDescriptor, "Failed in EquipmentsAddDescriptor");
            Assert.AreEqual("Available", mock.Object.EquipmentsAddStatus, "Failed in EquipmentsAddStatus");
            Assert.AreEqual("Denton, TX", mock.Object.EquipmentsAddJobLocation, "Failed in EquipmentsAddJobLocation");
            Assert.AreEqual("ATA", mock.Object.EquipmentsAddType, "Failed in EquipmentsAddType");
            Assert.AreEqual("Up", mock.Object.EquipmentsAddOperationStatus, "Failed in EquipmentsAddOperationStatus");
            Assert.AreEqual("PA000123", mock.Object.EquipmentsAddJobNumber, "Failed in EquipmentsAddJobNumber");
            Assert.AreEqual(false, mock.Object.EquipmentsAddchkEquipmentAdd, "Failed in EquipmentsAddchkEquipmentAdd");
            Assert.AreEqual("1", mock.Object.EquipmentsAddEquipmentId, "Failed in EquipmentsAddEquipmentId");
            Assert.AreEqual("True", mock.Object.EquipmentsAddIsCombo, "Failed in EquipmentsAddIsCombo");
            Assert.AreEqual("False", mock.Object.EquipmentsAddIsComboUnit, "Failed in EquipmentsAddIsComboUnit");
            Assert.AreEqual(string.Format("javascript: var newWindow = window.open('/JobRecord.aspx?JobId={0}', '', 'width=870, height=600, scrollbars=1, resizable=yes');", mock.Object.EquipmentRowDataItem.JobID.Value), mock.Object.EquipmentsAddJobNumberNavigateUrl, "Failed in EquipmentsAddJobNumberNavigateUrl");
            Assert.AreEqual(string.Format("javascript: var newWindow = window.open('/CallEntry.aspx?JobId={0}&CallEntryId={1}', '', 'width=800, height=600, scrollbars=1, resizable=yes');", mock.Object.EquipmentRowDataItem.JobID.Value, mock.Object.EquipmentRowDataItem.CallLogID), mock.Object.EquipmentsAddTypeNavigateUrl, "Failed in EquipmentsAddTypeNavigateUrl");
            Assert.AreEqual(123, mock.Object.EquipmentsAddComboID.Value, "Failed in EquipmentsAddComboID");
        }
        public void PermittingViewHierarchicalPrimaryRepeaterBind()
        {
            List<CS_View_EquipmentInfo> lstCombo = new List<CS_View_EquipmentInfo>();
            CS_View_EquipmentInfo dataItem = new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 1,
                    ComboName = "FTW-1",
                    JobStatus = "Combo1",
                    Descriptor = null,
                    DivisionID = 1,
                    DivisionName = "One",
                    DivisionState = "TX",
                    EquipmentID = 1,
                    EquipmentStatus = "Up",
                    IsPrimary = 1,
                    JobID = 1,
                    JobLocation = "TX",
                    JobNumber = "000001",
                    Status = "Reserved",
                    Type = "Type1",
                    UnitNumber = "NumberOne"
                };

            lstCombo.Add(dataItem);

            lstCombo.Add(
                new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 1,
                    ComboName = "FTW-1",
                    JobStatus = "Combo1",
                    Descriptor = null,
                    DivisionID = 1,
                    DivisionName = "One",
                    DivisionState = "TX",
                    EquipmentID = 2,
                    EquipmentStatus = "Down",
                    IsPrimary = 0,
                    JobID = 1,
                    JobLocation = "TX",
                    JobNumber = "000001",
                    Status = "Reserved",
                    Type = "Type1",
                    UnitNumber = "NumberTwo"
                });

            lstCombo.Add(
                new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 1,
                    ComboName = "FTW-1",
                    JobStatus = "Combo1",
                    Descriptor = null,
                    DivisionID = 1,
                    DivisionName = "One",
                    DivisionState = "TX",
                    EquipmentID = 3,
                    EquipmentStatus = "Up",
                    IsPrimary = 0,
                    JobID = 1,
                    JobLocation = "TX",
                    JobNumber = "000001",
                    Status = "Reserved",
                    Type = "Type1",
                    UnitNumber = "NumberThree"
                });

            lstCombo.Add(
                new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 2,
                    ComboName = "FTW-2",
                    JobStatus = "Combo2",
                    Descriptor = null,
                    DivisionID = 2,
                    DivisionName = "Two",
                    DivisionState = "MX",
                    EquipmentID = 4,
                    EquipmentStatus = "Up",
                    IsPrimary = 1,
                    JobID = 2,
                    JobLocation = "MX",
                    JobNumber = "000002",
                    Status = "Reserved",
                    Type = "Type2",
                    UnitNumber = "NumberFour"
                });

            lstCombo.Add(
                new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 2,
                    ComboName = "FTW-2",
                    JobStatus = "Combo2",
                    Descriptor = null,
                    DivisionID = 2,
                    DivisionName = "Two",
                    DivisionState = "MX",
                    EquipmentID = 5,
                    EquipmentStatus = "Up",
                    IsPrimary = 0,
                    JobID = 2,
                    JobLocation = "MX",
                    JobNumber = "000002",
                    Status = "Reserved",
                    Type = "Type2",
                    UnitNumber = "NumberFive"
                });

            lstCombo.Add(
                new CS_View_EquipmentInfo()
                {
                    Active = true,
                    ComboID = 2,
                    ComboName = "FTW-2",
                    JobStatus = "Combo2",
                    Descriptor = null,
                    DivisionID = 2,
                    DivisionName = "Two",
                    DivisionState = "MX",
                    EquipmentID = 6,
                    EquipmentStatus = "Up",
                    IsPrimary = 0,
                    JobID = 2,
                    JobLocation = "MX",
                    JobNumber = "000002",
                    Status = "Reserved",
                    Type = "Type2",
                    UnitNumber = "NumberSix"
                });

            //TODO
            Mock<IPermittingView> mock = new Mock<IPermittingView>();
            mock.SetupProperty(c => c.EquipmentInfoListData, lstCombo);
            mock.SetupProperty(c => c.FirstTierDataSource, new List<CS_View_EquipmentInfo>());

            PermittingViewModel viewModel = new PermittingViewModel(mock.Object);
            viewModel.GetFirstTierEquipmentList();

            Assert.AreEqual(2, mock.Object.FirstTierDataSource.Count);
        }