public void CanEditFixedAsset() { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { context.Context.ExecuteStoreCommand("DELETE FROM FixedAsset"); FixedAssetService transaction = new FixedAssetService(); FixedAsset asset = new FixedAsset() { inventory_number = "222222", cassation = false, date_of_activation = DateTime.Now, MPK = "AAAAAA" }; transaction.AddFixedAsset(asset); asset = context.Context.FixedAssets.FirstOrDefault(x => x.inventory_number == "222222"); asset.MPK = "BBBBB"; asset.inventory_number = "333333"; transaction.EditFixedAsset(asset); asset = context.Context.FixedAssets.FirstOrDefault(x => x.inventory_number == "333333"); Assert.IsNotNull(asset); Assert.AreEqual(context.Context.FixedAssets.Count(), 1); } }
public void CantEditNotExistingFixedAsset() { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { context.Context.ExecuteStoreCommand("DELETE FROM FixedAsset"); FixedAssetService transaction = new FixedAssetService(); FixedAsset asset = new FixedAsset() { inventory_number = "222222", cassation = false, date_of_activation = DateTime.Now, MPK = "AAAAAA" }; transaction.EditFixedAsset(asset); } }