コード例 #1
0
        public void GetDataPins_NoEvents_Ok()
        {
            PersonEventsPart part = GetPart(0);

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

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

            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("tot-count", pin.Name);
            Assert.Equal("0", pin.Value);
        }
コード例 #2
0
        public void GetDataPins_Events_Ok()
        {
            PersonEventsPart part = GetPart(3);

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

            Assert.Equal(10, pins.Count);
            TestHelper.AssertValidDataPinNames(pins);

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

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

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

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

            for (int n = 1; n <= 3; n++)
            {
                double expected = HistoricalDate.Parse($"{1200 + n} AD")
                                  .GetSortValue();
                pin = pins.Find(p => p.Name == "date-value" &&
                                p.Value == expected.ToString(CultureInfo.InvariantCulture));
                Assert.NotNull(pin);
                TestHelper.AssertPinIds(part, pin);
            }

            for (int n = 1; n <= 2; n++)
            {
                pin = pins.Find(p => p.Name == "place" &&
                                p.Value == $"place{n}");
                Assert.NotNull(pin);
                TestHelper.AssertPinIds(part, pin);

                pin = pins.Find(p => p.Name == "participant" &&
                                p.Value == $"tag:guy{n}");
                Assert.NotNull(pin);
                TestHelper.AssertPinIds(part, pin);
            }
        }