Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public void Update(Domain.Models.Person entity)
 {
     throw new NotImplementedException();
 }