コード例 #1
0
        public async Task CreateAsyncShouldCreateReceiptAndSaveItToDb()
        {
            var db = DbInfrastructure.GetDatabase();
            var receiptService = new ReceiptService(db);

            const decimal Fee = 5.23M;
            const string UserId = "UserId";

            await receiptService.CreateAsync(5.23M, 1, UserId);

            var receipt = await db.Receipts.FindAsync(1);

            receipt
                .Should()
                .NotBeNull();

            receipt
                .As<Receipt>()
                .RecipientId.Should().Be(UserId);

            receipt
                .As<Receipt>()
                .Fee.Should().Be(Fee);
        }