public void NewSubscriptionHandlerWithException() { //Arrange IAuthorisationView mockView = MockRepository.GenerateMock<IAuthorisationView>(); mockView.Stub(x => x.DisplaySubsriptions(Arg<List<string>>.Is.Anything)); IWizard mockWizard = MockRepository.GenerateMock<IWizard>(); mockWizard.Expect(x => x.addSID(Arg<string>.Is.Anything)).Throw(new InvalidSIDException()); mockWizard.Expect(x => x.GetSIDList()).Return(new List<string>()); IViewError mockErrorView = MockRepository.GenerateMock<IViewError>(); mockErrorView.Expect(x => x.NotifyOfError(Arg<Exception>.Is.Anything)); model = new OverRiddenAuthorisationModel_1(mockView, mockWizard, mockErrorView); //Act model.NewSubscriptionHandler(string.Empty); //Assert mockView.VerifyAllExpectations(); mockWizard.VerifyAllExpectations(); mockErrorView.VerifyAllExpectations(); }
public void NewSubscriptionHandlerNoExceptionTest() { //Arrange IAuthorisationView mockView = MockRepository.GenerateMock<IAuthorisationView>(); mockView.Expect(x => x.DisplaySubsriptions(Arg<List<string>>.Is.Anything)); IWizard mockWizard = MockRepository.GenerateMock<IWizard>(); mockWizard.Expect(x => x.addSID(Arg<string>.Is.Anything)); model = new OverRiddenAuthorisationModel_1(mockView, mockWizard); //Act model.NewSubscriptionHandler(string.Empty); //Assert mockView.VerifyAllExpectations(); mockWizard.VerifyAllExpectations(); }