public void ModifyPrintingValues_UserHasModifiedDigital_CurrentPrintingStyleKeyAndValueToChangeEqualsSetValue()
        {
            PrintingStyleClass expected = new PrintingStyleClass(1, 1.5F, 6.5F, 2);

            _mockView.SetupProperty(r => r.CurrentPrintingStyle, "Digital");
            _mockView.SetupProperty(r => r.CurrentPrintingStyleValues, expected);
            var comparer = new PrintingStyleEqualityComparer();

            _mockView.Raise(r => r.ModifyPrintingStyle += null, new EventArgs());

            //This works because in the ModifyPrintingStyle event, it calls two methods,
            //one to change the value in the file and one to refresh the data.
            //So therefore it modified the CurrentPrintingStyleKeyAndValueToChange property
            Assert.IsTrue(_mockView.Object.CurrentPrintingStyle == "Digital" && comparer.Equals(expected, _mockView.Object.CurrentPrintingStyleValues));
        }
Exemple #2
0
        public void PopulatePrintingStyleValues_UserInitiatedDataRefresh_PrintingStyleValuesDataUpdated()
        {
            PrintingStyleClass expected = new PrintingStyleClass(1, 2.5F, 6.5F, 6.8F);

            _mockView.SetupProperty(r => r.Gripper, 1);
            _mockView.SetupProperty(r => r.TailMargin, 2);
            _mockView.SetupProperty(r => r.SideMargin, 3);
            _mockView.SetupProperty(r => r.Bleeds, 4);
            _mockSystemVariablesManager.Setup(r => r.ReturnPrintingStyleValuesBasedOnPassedInStyle("Sheet Fed"))
            .Returns(expected);

            _mockView.Raise(r => r.RefreshData += null, new EventArgs());

            Assert.IsTrue(_mockView.Object.Gripper == expected.Gripper && _mockView.Object.SideMargin == expected.SideMargin &&
                          _mockView.Object.TailMargin == expected.TailMargin && _mockView.Object.Bleeds == expected.Bleeds);
        }
        /// <summary>
        /// Update any of the printing style attribles
        /// </summary>
        /// <param name="printingStyle"></param>
        /// <param name="valuesToChange"></param>
        public void ModifyPrintingStyleValues(string printingStyle, PrintingStyleClass valuesToChange)
        {
            if (File.Exists(expectedFilePath))
            {
                var currentJsonInFile = JObject.Parse(File.ReadAllText(expectedFilePath));
                currentJsonInFile["SystemVariables"]["PrintingStyles"][printingStyle]["Bleeds"]     = valuesToChange.Bleeds;
                currentJsonInFile["SystemVariables"]["PrintingStyles"][printingStyle]["SideMargin"] = valuesToChange.SideMargin;
                currentJsonInFile["SystemVariables"]["PrintingStyles"][printingStyle]["TailMargin"] = valuesToChange.TailMargin;
                currentJsonInFile["SystemVariables"]["PrintingStyles"][printingStyle]["Gripper"]    = valuesToChange.Gripper;

                File.WriteAllText(expectedFilePath, currentJsonInFile.ToString());
            }
            else
            {
                throw new Exception("Setup file not located. Please run the Inital Set up application. Please ask Andrew for more information.");
            }
        }
Exemple #4
0
 public void ModifyPrintingStyleValues(string printingSyle, PrintingStyleClass valuesToChange)
 {
     _systemVariablesRepo.ModifyPrintingStyleValues(printingSyle, valuesToChange);
 }