예제 #1
0
        public async Task Update_transaction_date()
        {
            PurchaseTransactionId transactionId = await CreateValidPurchaseTransaction();

            var repository = new PurchaseTransactionRepository(fixture.context);

            Assert.True(await repository.ExistsAsync(transactionId));

            var sut = await repository.LoadFullPurchaseTransactionAsync(transactionId);

            Assert.Equal(DateTime.Now.Date, sut.PurchaseDate);

            await UpdatePurchaseDate(sut.Id, DateTime.Now.AddDays(-1));

            await fixture.context.Entry(sut).ReloadAsync();

            Assert.Equal(DateTime.Now.AddDays(-1).Date, sut.PurchaseDate);
        }
예제 #2
0
        public async Task Change_Store()
        {
            var purchaseTransactionId = await CreateValidPurchaseTransaction();

            var repository = new PurchaseTransactionRepository(fixture.context);

            var sut = await repository.GetAsync(purchaseTransactionId);

            Assert.True(await repository.ExistsAsync(purchaseTransactionId));

            Assert.NotNull(sut);

            var newStore = await StoreHelpers.CreateValidStore();

            await UpdateStore(sut.Id, newStore);

            sut = await repository.LoadFullPurchaseTransactionAsync(sut.Id);

            await fixture.context.Entry(sut).ReloadAsync();

            Assert.Equal(newStore.Id, sut.Store.Id);
        }