Ejemplo n.º 1
0
        public void ByIdAsyncShouldThrowInvalidOperationExceptionIfUserIsNull()
        {
            var db = DbInfrastructure.GetDatabase();
            var receiptService = new ReceiptService(db);

            Func<Task> func = async () => await receiptService.ByIdAsync(null, 1);

            func.Should().Throw<InvalidOperationException>();
        }
Ejemplo n.º 2
0
        public async Task ByIdAsyncShouldThrowInvalidOperationExceptionIfReceiptIsNotFound()
        {
            var db = DbInfrastructure.GetDatabase();
            var receiptService = new ReceiptService(db);

            var user = new User
            {
                UserName = "******"
            };

            await db.AddAsync(user);
            await db.SaveChangesAsync();

            Func<Task> func = async () => await receiptService.ByIdAsync(user, 1);

            func.Should().Throw<InvalidOperationException>();
        }