Exemplo n.º 1
0
        public async void VerifyCreateItem()
        {
            var rent = _mapper.Map <Rental>(RentalTestData.Get());

            _rentalMock.Setup(x => x.Add(It.IsAny <Rental>())).ReturnsAsync(rent);

            var dbRent = await _rentalApplication.Create(RentalTestData.Get());

            _rentalMock.Verify(x => x.Add(It.IsAny <Rental>()), Times.Once);
        }
Exemplo n.º 2
0
        public async void VerifyGetAllItems()
        {
            var rents = _mapper.Map <IEnumerable <Rental> >(RentalTestData.GetAll());

            _rentalMock.Setup(x => x.GetAll()).ReturnsAsync(rents);

            var dbRents = await _rentalApplication.GetAll();

            Assert.True(dbRents.Any());
            Assert.True(dbRents.Count() == 3);
            _rentalMock.Verify(x => x.GetAll(), Times.Once);
        }