Ejemplo n.º 1
0
        public void GetDataPins_NoEntries_Ok()
        {
            MsPlacesPart part = GetPart();

            part.Places.Clear();

            List <DataPin> pins = part.GetDataPins(null).ToList();

            Assert.Single(pins);
            DataPin pin = pins[0];

            Assert.Equal("tot-count", pin.Name);
            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("0", pin.Value);
        }
Ejemplo n.º 2
0
        public void GetDataPins_Entries_Ok()
        {
            MsPlacesPart part = GetEmptyPart();

            for (int n = 1; n <= 3; n++)
            {
                bool even = n % 2 == 0;
                part.Places.Add(new MsPlace
                {
                    Area    = even? "even" : "odd",
                    City    = even? "Paris" : "Rome",
                    Address = even? "ea, eb" : "oa, ob"
                });
            }

            List <DataPin> pins = part.GetDataPins(null).ToList();

            Assert.Equal(11, pins.Count);

            DataPin pin = pins.Find(p => p.Name == "tot-count");

            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("3", pin.Value);

            // area
            pin = pins.Find(p => p.Name == "area" && p.Value == "even");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "area" && p.Value == "odd");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "city" && p.Value == "rome");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "city" && p.Value == "paris");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address" && p.Value == "ea, eb");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address" && p.Value == "oa, ob");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address-1" && p.Value == "ea");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address-2" && p.Value == "eb");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address-1" && p.Value == "oa");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

            pin = pins.Find(p => p.Name == "address-2" && p.Value == "ob");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);
        }