Ejemplo n.º 1
0
        public void MaxCreatedLenArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.MaxCreated = "2012010101";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 2
0
        public void DimLenException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.Dim = "1.0";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 3
0
        public void SetBbox()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.Bbox = "1.0,-2,1.0,1";
            Assert.That(sc.Bbox == "1.0,-2,1.0,1");
        }
Ejemplo n.º 4
0
        public void CreateUrl()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxCreated    = "20100115";
            sc.MinCreated    = "20100101";
            sc.ObjectType    = "villa, radhus";
            sc.MaxPlotArea   = 6000;
            sc.MinPlotArea   = 200;
            sc.MaxLivingArea = 500;
            sc.MinLivingArea = 10;
            sc.MaxRent       = 500;
            sc.MaxRooms      = 4;
            sc.MinRooms      = 2;
            sc.MaxPrice      = 2000000;
            sc.MinPrice      = 200000;
            sc.AreaId        = "1,2,3";
            sc.Bbox          = "-1,1,1,-1";
            sc.Dim           = "1,1";
            sc.Center        = "1,1";
            sc.Q             = "nacka";



            Assert.That(sc.CreateUrl() == "offset=0&limit=3&maxCreated=20100115&minCreated=20100101&objectType=villa, radhus&maxPlotArea=6000&minPlotArea=200&maxLivingArea=500&minLivingArea=10&maxRent=500&maxRooms=4&minRooms=2&maxPrice=2000000&minPrice=200000&areaId=1,2,3&bbox=-1,1,1,-1&dim=1,1&center=1,1&q=nacka");
        }
Ejemplo n.º 5
0
        public void SearchConditionsClear()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxCreated    = "20100115";
            sc.MinCreated    = "20100101";
            sc.ObjectType    = "villa, radhus";
            sc.MaxPlotArea   = 6000;
            sc.MinPlotArea   = 200;
            sc.MaxLivingArea = 500;
            sc.MinLivingArea = 10;
            sc.MaxRent       = 500;
            sc.MaxRooms      = 4;
            sc.MinRooms      = 2;
            sc.MaxPrice      = 2000000;
            sc.MinPrice      = 200000;
            sc.AreaId        = "1,2,3";
            sc.Bbox          = "-1,1,1,-1";
            sc.Dim           = "1,1";
            sc.Center        = "1,1";
            sc.Q             = "nacka";

            sc.CreateUrl();
            sc.ClearSearch();

            sc.Q     = "angered";
            sc.Limit = 5;

            Assert.That(sc.CreateUrl() == "offset=0&limit=5&q=angered");
        }
Ejemplo n.º 6
0
        public void SetOffset()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.Offset = 5;
            Assert.That(sc.Offset == 5);
        }
Ejemplo n.º 7
0
        public void CreateUrlArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => { sc.Offset = 5; sc.CreateUrl(); };

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 8
0
        public void SetMinLivingArea()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MinLivingArea = 85;
            Assert.That(sc.MinLivingArea == 85);
        }
Ejemplo n.º 9
0
        public void SetMaxLivingArea()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxLivingArea = 250;
            Assert.That(sc.MaxLivingArea == 250);
        }
Ejemplo n.º 10
0
        public void SetCenter()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.Center = "-50.5,120.5";
            Assert.That(sc.Center == "-50.5,120.5");
        }
Ejemplo n.º 11
0
        public void SetMaxRent()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxRent = 7;
            Assert.That(sc.MaxRent == 7);
        }
Ejemplo n.º 12
0
        public void MinRoomsNegativeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.MinRooms = -1;

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 13
0
        public void SetMinRooms()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MinRooms = 0;
            Assert.That(sc.MinRooms == 0);
        }
Ejemplo n.º 14
0
        public void SetMaxPrice()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxPrice = 140;
            Assert.That(sc.MaxPrice == 140);
        }
Ejemplo n.º 15
0
        // Listings examples
        public void RunSimpleListingsExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc  = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionList(); //Extended search condition for lists, only used as argument here

            sc.Q     = "Nacka";
            sc.Limit = 5;

            var result = booli.GetResultList(sc, esc);

            Console.WriteLine("Simple Listings Example\n");
            Console.WriteLine("Result:\n");
            Console.WriteLine("Count: " + result.count.ToString());
            Console.WriteLine("Total count: " + result.totalCount.ToString());

            foreach (Listing listing in result.listings)
            {
                Console.WriteLine("\n===========");
                Console.WriteLine("BooliId: " + listing.booliId.ToString());
                Console.WriteLine("List price: " + listing.listPrice.ToString());
                Console.WriteLine("Living Area: " + listing.livingArea.ToString());
                Console.WriteLine("City: " + listing.location.address.city.ToString());
                Console.WriteLine("Street Adress: " + listing.location.address.streetAddress.ToString());
            }
        }
Ejemplo n.º 16
0
        public void SetMaxPlotArea()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxPlotArea = 5500;
            Assert.That(sc.MaxPlotArea == 5500);
        }
Ejemplo n.º 17
0
        public void SetLimit()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.Limit = 13;
            Assert.That(sc.Limit == 13);
        }
Ejemplo n.º 18
0
        public void MaxPlotAreaNegativeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.MaxPlotArea = -6500;

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 19
0
        public void OffsetNegativeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.Offset = -7;

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 20
0
        public void SetObjectType()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.ObjectType = "villa,lägenhet";
            Assert.That(sc.ObjectType == "villa,lägenhet");
        }
Ejemplo n.º 21
0
        public void CreateUrlMissingCenterArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => { sc.Center = "50.0,14.1"; sc.CreateUrl(); };

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 22
0
        public void DuplicateObjectTypeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.ObjectType = "villa,villa";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 23
0
        public void CenterLongOutOfBoundException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.Center = "-81.2,191.4";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 24
0
        public void UnknownObjectTypeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.ObjectType = "villa,lägenhet,banan";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 25
0
        public void SetDim()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.Dim = "1.0,1.0";
            Assert.That(sc.Dim == "1.0,1.0");
        }
Ejemplo n.º 26
0
        public void SetMaxCreated()
        {
            var sc = new BooliNET.BooliSearchCondition();

            sc.MaxCreated = "20110102";
            Assert.That(sc.MaxCreated == "20110102");
        }
Ejemplo n.º 27
0
        public void DimArg2OutOfBoundException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.Dim = "91,-160.4";

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 28
0
        public void MaxCreatedFormatException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.MinCreated = "20121301";

            Assert.Throws <FormatException>(throwingCode);
        }
Ejemplo n.º 29
0
        public void AreaIdFormatException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.AreaId = "1,2,3,G";;

            Assert.Throws <FormatException>(throwingCode);
        }
Ejemplo n.º 30
0
        public void AreaIdNegativeArgumentException()
        {
            var          sc           = new BooliNET.BooliSearchCondition();
            TestDelegate throwingCode = () => sc.AreaId = "1,2,3,-11";;

            Assert.Throws <ArgumentException>(throwingCode);
        }
Ejemplo n.º 31
0
        public void AreaIdListingsExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionList();
            sc.AreaId = "76,16";
            sc.MinRooms = 3;
            sc.Limit = 5;

            var result = booli.GetResultList(sc, esc);
            Console.WriteLine("Area Id Example!\n");
            Console.WriteLine(result.ToString());
        }
Ejemplo n.º 32
0
        public void BboxListingsExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionList();
            sc.Bbox = "57.69330,11.96522,57.73896,12.03320";
            esc.MinListPrice = 1000000;
            esc.MaxListPrice = 3000000;
            sc.Limit = 5;

            var result = booli.GetResultList(sc, esc);
            Console.WriteLine("Bbox Example!\n");
            Console.WriteLine(result.ToString());
        }
Ejemplo n.º 33
0
        public void CenterDimListingsExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionList();
            sc.Center = "59.34674,18.0603";
            sc.Dim = "15000,1000";
            sc.MinPlotArea = 100;
            sc.MaxPlotArea = 5000;
            sc.Limit = 5;

            var result = booli.GetResultList(sc, esc);
            Console.WriteLine("Center and Dim Example!\n");
            Console.WriteLine(result.ToString());
        }
Ejemplo n.º 34
0
        public void PriceSoldExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionSold();
            sc.Q = "Helsingborg";
            sc.MinRooms = 2;
            sc.Limit = 5;
            esc.MinSoldPrice = 2000000;
            esc.MaxSoldPrice = 3000000;
            esc.MinSoldDate = "20130101";
            esc.MaxSoldDate = "20130601";

            var result = booli.GetResultSold(sc, esc);
            Console.WriteLine("Price Sold Example!\n");
            Console.WriteLine(result.ToString());
        }
Ejemplo n.º 35
0
 public void SetObjectType()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.ObjectType = "villa,lägenhet";
     Assert.That(sc.ObjectType == "villa,lägenhet");
 }
Ejemplo n.º 36
0
 public void OffsetNegativeArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.Offset = -7;
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 37
0
 public void SetMinRooms()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MinRooms = 0;
     Assert.That(sc.MinRooms == 0);
 }
Ejemplo n.º 38
0
 public void MaxPlotAreaNegativeArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.MaxPlotArea = -6500;
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 39
0
 public void DimLenException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.Dim = "1.0";
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 40
0
 public void UnknownObjectTypeArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.ObjectType = "villa,lägenhet,banan";
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 41
0
 public void MinCreatedLenArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.MinCreated = "2011010101";
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 42
0
 public void SetLimit()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Limit = 13;
     Assert.That(sc.Limit == 13);
 }
Ejemplo n.º 43
0
 public void SetMaxLivingArea()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MaxLivingArea = 250;
     Assert.That(sc.MaxLivingArea == 250);
 }
Ejemplo n.º 44
0
 public void SetCenter()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Center = "-50.5,120.5";
     Assert.That(sc.Center == "-50.5,120.5");
 }
Ejemplo n.º 45
0
 public void SetDim()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Dim = "1.0,1.0";
     Assert.That(sc.Dim == "1.0,1.0");
 }
Ejemplo n.º 46
0
 public void SetBbox()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Bbox = "1.0,-2,1.0,1";
     Assert.That(sc.Bbox == "1.0,-2,1.0,1");
 }
Ejemplo n.º 47
0
 public void SetAreaId()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.AreaId = "1,2,3";
     Assert.That(sc.AreaId == "1,2,3");
 }
Ejemplo n.º 48
0
        public void SearchConditionsClear()
        {
            var sc = new BooliNET.BooliSearchCondition();
            sc.MaxCreated = "20100115";
            sc.MinCreated = "20100101";
            sc.ObjectType = "villa, radhus";
            sc.MaxPlotArea = 6000;
            sc.MinPlotArea = 200;
            sc.MaxLivingArea = 500;
            sc.MinLivingArea = 10;
            sc.MaxRent = 500;
            sc.MaxRooms = 4;
            sc.MinRooms = 2;
            sc.MaxPrice = 2000000;
            sc.MinPrice = 200000;
            sc.AreaId = "1,2,3";
            sc.Bbox = "-1,1,1,-1";
            sc.Dim = "1,1";
            sc.Center = "1,1";
            sc.Q = "nacka";

            sc.CreateUrl();
            sc.ClearSearch();

            sc.Q = "angered";
            sc.Limit = 5;

            Assert.That(sc.CreateUrl() == "offset=0&limit=5&q=angered");
        }
Ejemplo n.º 49
0
 public void SetOffset()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Offset = 5;
     Assert.That(sc.Offset == 5);
 }
Ejemplo n.º 50
0
 public void SetMaxRooms()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MaxRooms = 7;
     Assert.That(sc.MaxRooms == 7);
 }
Ejemplo n.º 51
0
 public void SetQ()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.Q = "Nacka";
     Assert.That(sc.Q == "Nacka");
 }
Ejemplo n.º 52
0
 public void SetMinCreated()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MinCreated = "20100102";
     Assert.That(sc.MinCreated == "20100102");
 }
Ejemplo n.º 53
0
        public void CreateCompleteUrlTest()
        {
            var sc = new BooliNET.BooliSearchCondition();
            sc.Q = "angered";

            string url = BooliNET.BooliUtil.CreateCompleteUrl("/listings?"+sc.CreateUrl(), "bomano", "P3tfkeJvKOXgHjvXZ1xpRXVGG2kHPmFpd7BZetHY");
            string pattern = "http://api.booli.se/listings\\?offset=0&limit=3&q=angered&callerId=bomano&time=.{10}&unique=.{16}&hash=.{40}";
            Assert.That(System.Text.RegularExpressions.Regex.IsMatch(url, pattern) == true);
        }
Ejemplo n.º 54
0
 public void SetMinLivingArea()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MinLivingArea = 85;
     Assert.That(sc.MinLivingArea == 85);
 }
Ejemplo n.º 55
0
        // Sold examples
        public void RunSimpleSoldExample()
        {
            var booli = new BooliNET.Booli(CallerId, Key);

            var sc = new BooliNET.BooliSearchCondition();
            var esc = new BooliNET.ExtendedSearchConditionSold(); //Extended search condition for sold, only used as argument here
            sc.Q = "Nacka";
            sc.Limit = 5;

            var result = booli.GetResultSold(sc, esc);
            Console.WriteLine("Simple Sold Example\n");
            Console.WriteLine("Result:\n");
            Console.WriteLine("Count: " + result.count.ToString());
            Console.WriteLine("Total count: " + result.totalCount.ToString());

            foreach (Sold listing in result.sold)
            {
                Console.WriteLine("\n===========");
                Console.WriteLine("BooliId: " + listing.booliId.ToString());
                Console.WriteLine("Sold price: " + listing.soldPrice.ToString());
                Console.WriteLine("Living Area: " + listing.livingArea.ToString());
                Console.WriteLine("City: " + listing.location.address.city.ToString());
                Console.WriteLine("Street Adress: " + listing.location.address.streetAddress.ToString());
            }
        }
Ejemplo n.º 56
0
 public void SetMinPlotArea()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MinPlotArea = 500;
     Assert.That(sc.MinPlotArea == 500);
 }
Ejemplo n.º 57
0
 public void MaxCreatedFormatException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.MinCreated = "20121301";
     Assert.Throws<FormatException>(throwingCode);
 }
Ejemplo n.º 58
0
 public void SetMinPrice()
 {
     var sc = new BooliNET.BooliSearchCondition();
     sc.MinPrice = 120;
     Assert.That(sc.MinPrice == 120);
 }
Ejemplo n.º 59
0
 public void DuplicateObjectTypeArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.ObjectType = "villa,villa";
     Assert.Throws<ArgumentException>(throwingCode);
 }
Ejemplo n.º 60
0
 public void MinRoomsNegativeArgumentException()
 {
     var sc = new BooliNET.BooliSearchCondition();
     TestDelegate throwingCode = () => sc.MinRooms = -1;
     Assert.Throws<ArgumentException>(throwingCode);
 }