public static void Update(this CandidateSource domain, CandidateSourceDTO dto) { domain.Path = dto.Path; domain.SourceId = dto.SourceId; domain.State = dto.State; }
public void ShouldAddSources() { var httpResult = controller.Get(1); var response = httpResult as JsonResult<CandidateDTO>; var candidate = response.Content; int source = context.Sources.First().Id; var newCandidateSource = new CandidateSourceDTO { Path = "candidate social path", SourceId = source }; var sources = candidate.Sources.ToList(); sources.Add(newCandidateSource); candidate.Sources = sources; var newHttpResult = controller.Put(candidate.Id, candidate); var newResponse = newHttpResult as JsonResult<CandidateDTO>; var newCandidate = newResponse.Content; Assert.IsTrue(newCandidate.Sources.Any(x => x.Path == "candidate social path" && x.SourceId == source)); }