public void Migrate() { var priceId = localSession.Query <Price>().First().Id.PriceId; var supplierId = localSession.Query <Supplier>().First().Id; var addressId = localSession.Query <Address>().First().Id; Directory.GetFiles(".", "*.txt").Each(File.Delete); FileHelper.InitDir("in\\update"); localSession.Clear(); DbHelper.Drop(); using (var sanityCheck = new SanityCheck(clientConfig)) sanityCheck.Check(true); using (var cleaner = new FileCleaner()) { var cmd = new UpdateCommand(); cmd.Configure(settings, clientConfig); cmd.Process(() => { cmd.Download(); var dir = Directory.CreateDirectory("in\\update"); cleaner.WatchDir(dir.FullName); new DirectoryInfo(clientConfig.UpdateTmpDir).EnumerateFiles().Each(x => { x.MoveTo(Path.Combine(dir.FullName, x.Name)); }); //идентфикаторы в тестовых данных return(UpdateResult.OK); }); cmd = new UpdateCommand(); cmd.Configure(settings, clientConfig); cmd.Process(() => { new DirectoryInfo("../../Assets/").EnumerateFiles().Each(x => cleaner.Watch(x.CopyTo(x.Name, true).FullName)); cmd.Migrate(); return(UpdateResult.OK); }); } //идентификаторы не совпадают тк данные для переноса статичные, подделываем id для проверки localSession.CreateSQLQuery(@" update Prices set PriceId = 7537 where PriceId = :priceId; update Suppliers set Id = 234 where Id = :supplierId; update Addresses set Id = 2575 where Id = :addressId") .SetParameter("priceId", priceId) .SetParameter("supplierId", supplierId) .SetParameter("addressId", addressId) .ExecuteUpdate(); settings = localSession.Query <Settings>().First(); Assert.IsNotNull(settings.Password); Assert.AreEqual(Taxation.Nds, settings.Waybills[0].Taxation); var map = localSession.Query <DirMap>().First(x => x.Supplier.Id == 18089); Assert.AreEqual(".\\Загрузка\\Предельные цены производителей", map.Dir); var order = localSession.Query <Order>().First(); Assert.IsNotNull(order.Price); Assert.IsNotNull(order.Address); Assert.That(order.Lines[0].ResultCost, Is.GreaterThan(0)); Assert.That(order.Lines[0].Producer, Is.Not.Null.Or.Empty); var sentOrder = localSession.Query <SentOrder>().First(); Assert.IsNotNull(sentOrder.Price); Assert.IsNotNull(sentOrder.Address); Assert.That(sentOrder.Lines[0].ResultCost, Is.GreaterThan(0)); Assert.That(sentOrder.Lines[0].Producer, Is.Not.Null.Or.Empty); var waybill = localSession.Query <Waybill>().First(x => x.Id == 39153110); Assert.IsNotNull(waybill.Supplier); Assert.IsNotNull(waybill.Address); var line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "10891996"); Assert.AreEqual(35, line.MaxRetailMarkup); Assert.AreEqual(678.50, line.RetailCost); Assert.AreEqual(35, line.RetailMarkup); Assert.AreEqual(35, line.RealRetailMarkup); line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "10137353" && x.Product.Contains("Ацетилсалициловой")); Assert.AreEqual(29.99m, line.RetailMarkup); Assert.AreEqual(70.21m, line.RealRetailMarkup); Assert.AreEqual(613.70m, line.RetailCost); line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "017022014"); Assert.AreEqual(21.36m, line.RetailMarkup); Assert.AreEqual(49.99m, line.RealRetailMarkup); Assert.AreEqual(540.80m, line.RetailCost); line = waybill.Lines.FirstOrDefault(x => x.SerialNumber == "156014"); Assert.AreEqual(77.63m, line.RetailMarkup); Assert.AreEqual(82.03m, line.RealRetailMarkup); Assert.AreEqual(500m, line.RetailCost); }