예제 #1
0
        public virtual void VoucherTest(string dt, VoucherType type)
        {
            var voucher1 = VoucherDataProvider.Create(dt, type);
            var voucher2 = Serializer.ParseVoucher(Serializer.PresentVoucher(voucher1));

            voucher2.Type ??= VoucherType.Ordinary;
            Assert.Equal(voucher1, voucher2, new VoucherEqualityComparer());
        }
예제 #2
0
        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());
        }
예제 #3
0
    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());
    }