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

            string         json  = TestHelper.SerializePart(part);
            PrisonInfoPart part2 = TestHelper.DeserializePart <PrisonInfoPart>(json);

            Assert.Equal(part.Id, part2.Id);
            Assert.Equal(part.TypeId, part2.TypeId);
            Assert.Equal(part.ItemId, part2.ItemId);
            Assert.Equal(part.RoleId, part2.RoleId);
            Assert.Equal(part.CreatorId, part2.CreatorId);
            Assert.Equal(part.UserId, part2.UserId);
            // TODO: check parts data here...
        }
Пример #2
0
        public void Seed_Ok()
        {
            PrisonInfoPartSeeder seeder = new PrisonInfoPartSeeder();

            seeder.SetSeedOptions(_seedOptions);

            IPart part = seeder.GetPart(_item, null, _factory);

            Assert.NotNull(part);

            PrisonInfoPart p = part as PrisonInfoPart;

            Assert.NotNull(p);

            TestHelper.AssertPartMetadata(p);

            // TODO: assert properties like:
            // Assert.NotEmpty(p.Works);
        }
Пример #3
0
        public void GetDataPins_Ok()
        {
            PrisonInfoPart part = GetEmptyPart();

            part.PrisonId = "pal";
            part.Place    = "Palermo";

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

            Assert.Equal(2, pins.Count);

            DataPin pin = pins.Find(p => p.Name == "id" && p.Value == "pal");

            Assert.NotNull(pin);
            TestHelper.AssertPinIds(part, pin);

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