public void VoucherStoreTest(string dt, VoucherType type) { var voucher1 = new Voucher { Date = dt.ToDateTime(), Type = type, Remark = "tt", Details = new List <VoucherDetail> { new VoucherDetail { User = "******", Currency = "CNY", Title = 1001, Content = "asdf", Fund = 123.45 }, new VoucherDetail { User = "******", Currency = "USD", Title = 1002, SubTitle = 12, Fund = -123.45, Remark = "qwer" } } }; m_Adapter.Upsert(voucher1); var voucher2 = m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).Single(); Assert.Equal(voucher1, voucher2, new VoucherEqualityComparer()); var voucher3 = m_Adapter.SelectVoucher(voucher1.ID); Assert.Equal(voucher1, voucher3, new VoucherEqualityComparer()); Assert.True(m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).Any()); }
public void VoucherStoreTest(string dt, VoucherType type) { var voucher1 = VoucherDataProvider.Create(dt, type); m_Adapter.Upsert(voucher1); Assert.NotNull(voucher1.ID); var voucher2 = m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).Single(); Assert.Equal(voucher1, voucher2, new VoucherEqualityComparer()); var voucher3 = m_Adapter.SelectVoucher(voucher1.ID); Assert.Equal(voucher1, voucher3, new VoucherEqualityComparer()); Assert.True(m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).Any()); }
public async Task VoucherStoreTest(string dt, VoucherType type) { var voucher1 = VoucherDataProvider.Create(dt, type); Assert.True(await m_Adapter.Upsert(voucher1)); Assert.NotNull(voucher1.ID); voucher1.Remark = "whatever"; Assert.True(await m_Adapter.Upsert(voucher1)); var voucher2 = await m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).SingleAsync(); Assert.Equal(voucher1, voucher2, new VoucherEqualityComparer()); var voucher3 = await m_Adapter.SelectVoucher(voucher1.ID); Assert.Equal(voucher1, voucher3, new VoucherEqualityComparer()); Assert.True(await m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(await m_Adapter.DeleteVoucher(voucher1.ID)); Assert.False(await m_Adapter.SelectVouchers(VoucherQueryUnconstrained.Instance).AnyAsync()); }