コード例 #1
0
        public async Task InvoiceGetAllAsync()
        {
            // Act
            var invoices = await _repo.GetAllAsync();

            // Assert
            Assert.Single(invoices);
        }
コード例 #2
0
        public async Task DotMemoryUnitTest()
        {
            var repo = new InvoiceRepository();

            await repo.GetAllAsync();

            dotMemory.Check(memory =>
                            Assert.Equal(1, memory.GetObjects(where => where.Type.Is <Invoice>()).ObjectsCount));

            GC.KeepAlive(repo); // prevent objects from GC if this is implied by test logic
        }
コード例 #3
0
 public async Task <ActionResult <IEnumerable <Invoice> > > GetInvoices()
 {
     try
     {
         return(await _invoiceRepository.GetAllAsync());
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }