Пример #1
0
        public void TestConvertToStreamAndBack()
        {
            var stream         = _converter.ConvertToStream(_dataStub);
            var testFromStream = _converter.ConvertFromStream(stream);

            var testCars = _dataStub.GetCars();
            var cars     = testFromStream.GetCars();

            // Here we can use more than one assert because there no matter why collecation are different
            Assert.True(testCars.Length == cars.Length);

            for (var i = 0; i < cars.Length; i++)
            {
                var car     = cars[i];
                var testCar = testCars[i];
                Assert.AreEqual(car.GetBrandName(), testCar.GetBrandName());
                Assert.AreEqual(car.GetBrandName(), BrandByIterator(i));
                Assert.AreEqual(car.GetDate(), testCar.GetDate());
                Assert.AreEqual(car.GetDate(), DateByIterator(i));
                Assert.AreEqual(car.GetPrice(), testCar.GetPrice());
                Assert.AreEqual(car.GetPrice(), PriceByIterator(i));
            }
        }