/// <summary> /// On form load, assign the presenter. This will mean that all events will have methods /// attached when invoked. /// Also call FormOnLoad to set the page up /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ImpositionForm_Load(object sender, EventArgs e) { //Cannot use inject this presenter otherwise you get an inifinte loop of two classes injecting each other Presenter = new ImpositionCalculatorPresenter(this, _signatureSizeManager, _systemVariablesManager, _systemVariablesFormPresenter, _printingDesignManager); try { FormOnLoad(this, e); } catch (Exception ex) { Error(this, new ErrorEventArgs(ex.Message)); } }
/* Ideas on what to test: * Correct outcome * Error being logged to view * * Individual methods * Methods working together so check to see if other events get raised * CalculatePossibleOptions - Test the manager and maybe mock the repository so that we can see * if the values are calculated correctly. * */ public ImpositionCalculatorPresenterTestFixture() { _mockSystemVariablesView = new Mock <ISystemVariablesView>(); _mockPrintingDesignManager = new Mock <IPrintingDesignManager>(); _mockSystemVariablesManager = new Mock <ISystemVariablesManager>(); _systemVariablesPresenter = new SystemVariablesPresenter(_mockSystemVariablesView.Object, _mockSystemVariablesManager.Object); _mockImpositionCalculatorRepo = new Mock <IImpositionCalculatorRepository>(); _mockImpositionCalculatorManager = new Mock <IImpositionCalculatorManager>(); _mockView = new Mock <IImpositionFormView>(); _impositionCalculatorPresenter = new ImpositionCalculatorPresenter(_mockView.Object, _mockImpositionCalculatorManager.Object, _mockSystemVariablesManager.Object, _systemVariablesPresenter, _mockPrintingDesignManager.Object); }