Ejemplo n.º 1
0
        public async void VerifyFixExpirationDate()
        {
            DateTime fixedExpiration = DateTime.UtcNow.AddDays(30);

            mockDataHandler.Setup(m => m.GetData <Batch>(DataSource.Batches))
            .ReturnsAsync(batchList);

            mockDataHandler.Setup(
                m => m.WriteData(DataSource.Batches, It.IsAny <List <Batch> >())
                ).Returns(Task.CompletedTask);

            Batch udpatedBatch = await dataAccess.FixExpirationDate(testBatch1.Id, fixedExpiration);

            Assert.Equal(fixedExpiration, udpatedBatch.Expiration);

            mockDataHandler.Verify(m => m.GetData <Batch>(DataSource.Batches), Times.Once);
            mockDataHandler.Verify(m => m.WriteData(DataSource.Batches, It.IsAny <List <Batch> >()), Times.Once);
        }