public void SavePetEvent_Raised_SavesPetWithName() { _addPetView.SavePet += null; var savePetEvent = LastCall.IgnoreArguments().GetEventRaiser(); const string petName = "Fido"; const string breed = "pug"; const int age = 8; const string healthHistory = "Has had cysts removed on 3 occasions, risk of diabetes."; var id = Guid.NewGuid(); Expect.Call(_addPetView.Name).Return(petName).Repeat.AtLeastOnce(); Expect.Call(_addPetView.Breed).Return(breed).Repeat.AtLeastOnce(); Expect.Call(_addPetView.Age).Return(age).Repeat.AtLeastOnce(); Expect.Call(_addPetView.HealthHistory).Return(healthHistory).Repeat.AtLeastOnce(); _addPetView.Message = ""; var pet = new Pet { Name = "Fido", Breed = "beagle", Age = 3, Temperament = "gentle", HealthHistory = healthHistory }; _petRepository.SavePet(pet); _addPetView.Message = "Saved. (No page redirect yet.)"; _mockRepository.ReplayAll(); var sut = new AddPetPresenter(_petRepository, _addPetView); savePetEvent.Raise(_addPetView, EventArgs.Empty); }
public void Constructor_ViewInput_AttachesEvents() { _addPetView.SavePet += null; LastCall.IgnoreArguments(); _mockRepository.ReplayAll(); var sut = new AddPetPresenter(_petRepository, _addPetView); }
protected override void OnInit(EventArgs e) { _addPetPresenter = new AddPetPresenter(new PetRepositoryFake(), this); base.OnInit(e); }