00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 using NUnit.Framework; 00005 using HouseOver.THARM.Buildings; 00006 00007 namespace HouseOver.THARM.UnitTest 00008 { 00013 [TestFixture] 00014 public class RealtyManagerTest 00015 { 00016 CatalogueData data; 00017 RealtyManager rm; 00018 00019 Customer c; 00020 00024 [SetUp] 00025 public void Init() 00026 { 00027 data = new CatalogueData(); 00028 rm = new RealtyManager(data); 00029 00030 c = new Customer(1000, "Some name"); 00031 00032 data.Add(c); 00033 00034 data.Add(new Sale(30000, DateTime.Now, new House(10, 1200, 50, 1980, 3, 100), c)); 00035 data.Add(new Sale(40000, DateTime.Now, new Apartment(12, 1300, 60, 1975, 2, 5), c)); 00036 data.Add(new Sale(30000, DateTime.Now, new Domicile(14, 1200, 55, 1960, 2), c)); 00037 } 00038 00042 [Test] 00043 public void TestProfileMatch() 00044 { 00045 Profile p = new Profile(c, 35000, typeof(House)); 00046 00047 data.Add(p); 00048 00049 List<Sale> sales = rm.GetAllSalesWithinMaxPrice(30000); 00050 List<Sale> potential = rm.FindPotentialItems(p); 00051 00052 Assert.AreEqual(sales.Count, 2); 00053 Assert.AreEqual(potential.Count, 1); 00054 } 00055 00056 } 00057 }