Esempio n. 1
0
        public void Serialize_Returns_EmptyTankNodeWhenNoFish()
        {
            //Arrange
            var tank       = new Tank();
            var serializer = new XmlTankSerializer();

            //Act
            var result = serializer.Serialize(tank);

            //Assert
            Assert.That(result, Is.EqualTo("<FishTank />"));
        }
Esempio n. 2
0
        public void Serialize_Returns_FishInTheTank()
        {
            //Arrange
            var tank = new Tank().Add(new GoldFish {
                Name = "gold"
            }).Add(new AngelFish()
            {
                Name = "angel"
            });
            var serializer = new XmlTankSerializer();

            //Act
            var result = serializer.Serialize(tank);

            //Assert
            Assert.That(result, Is.EqualTo("<FishTank><Fish type=\"FishTank.GoldFish\"><Name>gold</Name></Fish><Fish type=\"FishTank.AngelFish\"><Name>angel</Name></Fish></FishTank>"));
        }