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"); }
/// <summary> /// Class Constructor /// </summary> /// <param name="view">Instance of the CustomerInfo View Interface</param> public ResourceAllocationPresenter(IResourceAllocationView view) { _view = view; _viewModel = new ResourceAllocationViewModel(view); }