Beispiel #1
0
        public void ShouldAddCandidateSocials()
        {
            var httpResult = controller.Get(1);
            var response   = httpResult as JsonResult <CandidateDTO>;
            var candidate  = response.Content;

            int socialId = context.SocialNetworks.First().Id;
            var path     = "TESTPATH";

            var newCandidateSocial = new CandidateSocialDTO
            {
                SocialNetworkId = socialId,
                Path            = path
            };

            var socials = candidate.SocialNetworks.ToList();

            socials.Add(newCandidateSocial);
            candidate.SocialNetworks = socials;

            var newHttpResult = controller.Put(candidate.Id, candidate);
            var newResponse   = newHttpResult as JsonResult <CandidateDTO>;
            var newCandidate  = newResponse.Content;

            Assert.IsTrue(newCandidate.SocialNetworks.Any(x => x.SocialNetworkId == socialId && x.Path == path));
        }
 public static void Update(this CandidateSocial domain, CandidateSocialDTO dto)
 {
     domain.Path            = dto.Path;
     domain.SocialNetworkId = dto.SocialNetworkId;
     domain.State           = dto.State;
 }