public void UpdateBand_WhenAlways_ShouldMapBand() { // Arrange string id = "akjsdh1u23917y189hj"; Core.Models.Band bandCore = new Core.Models.Band() { Id = id }; _mapper.Setup(x => x.Map <Infrastructure.Models.Band>(bandCore)); // Act _sut.UpdateBand(id, bandCore); // Assert _mapper.Verify(x => x.Map <Infrastructure.Models.Band>(bandCore)); }
public void CreateBand_WhenAlways_ShouldCallRepository() { // Arrange string id = "akjsdh1u23917y189hj"; Core.Models.Band bandCore = new Core.Models.Band() { Id = id }; Infrastructure.Models.Band bandInfra = new Infrastructure.Models.Band() { Id = id }; _mapper.Setup(x => x.Map <Infrastructure.Models.Band>(bandCore)).Returns(bandInfra); _bandsApiDataAdapter.Setup(x => x.CreateBand(bandInfra)); // Act _sut.CreateBand(bandCore); // Assert _bandsApiDataAdapter.Verify(x => x.CreateBand(bandInfra)); }
public async Task Put(string id, [FromBody] Models.Band band) { Core.Models.Band mappedBand = _mapper.Map <Core.Models.Band>(band); await _bandsService.UpdateBand(id, mappedBand); }
public async Task Post([FromBody] Models.Band band) { Core.Models.Band mappedBand = _mapper.Map <Core.Models.Band>(band); await _bandsService.CreateBand(mappedBand); }