Exemplo n.º 1
0
        public async Task Should_Call_AddAsync()
        {
            //Arrange

            const string name = "House Name";

            var model = new HouseToAdd {
                Name = name
            };

            var entity = new HouseEf {
                Name = name
            };

            _mapperMock.Setup(x => x.Map <HouseEf>(It.IsAny <HouseToAdd>()))
            .Returns(entity);

            _manager = new HouseManager(_mapperMock.Object, _houseRepositoryMock.Object);

            //Act

            await _manager.AddAsync(model);

            //Assert

            _mapperMock.Verify(x => x.Map <HouseEf>(It.IsAny <HouseToAdd>()));
            _houseRepositoryMock.Verify(x => x.AddAsync(entity), Times.Once);
        }