Esempio n. 1
0
		public ZillowFormView() {
			InitializeComponent();

			presenter = new ZillowFormPresenter();

			ReloadComboBox();
		}
		public void Search_UsesReturnedAddressToSave() {
			var api = MockRepository.GenerateMock<IZillowAPI>();
			var repo = MockRepository.GenerateMock<IRepository>();

			api.Stub(a => a.GetDeepSearchResults(null)).IgnoreArguments().Return(XDocument.Load("DeepSearchResult.xml"));
			api.Stub(a => a.GetMonthlyPaymentResults(null)).IgnoreArguments().Return(XDocument.Load("MonthlyResult.xml"));

			var presenter = new ZillowFormPresenter(api, repo);

			presenter.Search(new Address());
			repo.AssertWasCalled(r => r.Save(Arg<Address>.Matches(a => a.ID == "9872758")));
		}
		public void AddressIsValid() {
			var empty = "";
			var noComma = "17 West GolfView Road 19083";
			var noZip = "1418 Ashton Road";
			var good = "17 West GolfView Road, 19083";

			var presneter = new ZillowFormPresenter();

			Assert.IsTrue(presneter.IsAddressValid(good));
			Assert.IsFalse(presneter.IsAddressValid(empty));
			Assert.IsFalse(presneter.IsAddressValid(noComma));
			Assert.IsFalse(presneter.IsAddressValid(noZip));
		}