Пример #1
0
        public void AssetStoreTest(string dt, DepreciationMethod type)
        {
            var asset1 = AssetDataProvider.Create(dt, type);

            foreach (var item in asset1.Schedule)
            {
                item.Value = 0;
                if (item is DevalueItem dev)
                {
                    dev.Amount = 0;
                }
            }

            m_Adapter.Upsert(asset1);
            Assert.NotNull(asset1.ID);

            var asset2 = m_Adapter.SelectAssets(DistributedQueryUnconstrained.Instance).Single();

            Assert.Equal(asset1, asset2, new AssetEqualityComparer());

            var asset3 = m_Adapter.SelectAsset(asset1.ID.Value);

            Assert.Equal(asset1, asset3, new AssetEqualityComparer());

            Assert.True(m_Adapter.DeleteAsset(asset1.ID.Value));
            Assert.False(m_Adapter.DeleteAsset(asset1.ID.Value));

            Assert.False(m_Adapter.SelectAssets(DistributedQueryUnconstrained.Instance).Any());
        }