public int Insert(Domain.Models.Person entity) { Person entityToInsert = this.context.People.Create(); this.mapper.Map(entity, entityToInsert); this.context.People.Add(entityToInsert); this.context.SaveChanges(); return(entityToInsert.Id); }
public async Task CanGet() { // Arrange const int personId = 1234; var testPerson = new Domain.Models.Person { PersonId = personId, FirstName = "Nick", Surname = "Gowdy" }; ExternalApiService.Setup(x => x.GetAsync(It.IsAny <int>())) .ReturnsAsync(testPerson); // Act var response = await HttpClient.GetAsync($"person/{personId}"); // Assert var responseString = await response.Content.ReadAsStringAsync(); var person = JsonConvert.DeserializeObject <Person>(responseString); Assert.NotNull(person); Assert.Equal(personId, person.PersonId); Assert.Equal("Nick", person.FirstName); Assert.Equal("Gowdy", person.Surname); }
public void Update(Domain.Models.Person entity) { throw new NotImplementedException(); }