Пример #1
0
        public void GetDataPins_NoWorks_Ok()
        {
            PersonWorksPart part = GetPart(0);

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

            TestHelper.AssertValidDataPinNames(pins);

            Assert.Equal(3, pins.Count);

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

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

            pin = pins.Find(p => p.Name == "dubious-count");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("0", pin.Value);

            pin = pins.Find(p => p.Name == "lost-count");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("0", pin.Value);
        }
Пример #2
0
        public void GetDataPins_Works_Ok()
        {
            PersonWorksPart part = GetPart(3);

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

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

            // counts
            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 == "dubious-count");
            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);
            Assert.Equal("1", pin.Value);

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

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

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

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

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

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