Exemple #1
0
        public void Test_AddRelatedObjects()
        {
            ClientCandidate candidate = new ClientCandidate();

            ClientCandidateWorkProfile workProfile = candidate.WorkProfiles.AddNew();

            workProfile.CompanyName = "HirePro";


            ClientContact contact = new ClientContact();

            candidate.Contact = contact;

            contact.Address = "277 5th Cross 6th Block Koramangala";

            Assert.IsTrue(candidate.IsDirty);
            Assert.IsTrue(candidate.WorkProfiles.IsDirty);
            Assert.IsTrue(candidate.Contact.IsDirty);

            Assert.IsTrue(candidate.IsValid);
            Assert.IsTrue(candidate.WorkProfiles.IsValid);
            Assert.IsTrue(candidate.Contact.IsValid);

            Assert.IsTrue(candidate.IsNew);
            Assert.IsTrue(candidate.Contact.IsNew);

            Assert.AreEqual(candidate.WorkProfiles.Count, 1);
            Assert.AreEqual(candidate.WorkProfiles.NewItems.Count, 1);
            Assert.AreEqual(candidate.WorkProfiles.ModifiedItems.Count, 0);
            Assert.AreEqual(candidate.WorkProfiles.DeletedItems.Count, 0);
        }
Exemple #2
0
        public void Test_Save()
        {
            ClientCandidate candidate = new ClientCandidate();

            ClientCandidateWorkProfile workProfile = candidate.WorkProfiles.AddNew();

            workProfile.CompanyName = "HirePro";

            ClientContact contact = new ClientContact();

            candidate.Contact = contact;

            contact.Address = "277 5th Cross 6th Block Koramangala";

            MemoryRepository <ClientCandidate> .Save(candidate);

            Assert.IsFalse(candidate.IsNew);

            Assert.IsFalse(candidate.IsDirty);
            Assert.IsFalse(candidate.WorkProfiles.IsDirty);
            Assert.IsFalse(candidate.Contact.IsDirty);

            Assert.IsTrue(candidate.IsValid);

            Assert.IsFalse(candidate.IsSavable);
            Assert.IsFalse(candidate.CanSave());

            Assert.IsNotNull(candidate.WorkProfiles);
            Assert.AreEqual(candidate.WorkProfiles.Count, 1);
            Assert.IsNotNull(candidate.Contact);
        }
Exemple #3
0
 public static void ServiceToBusiness(CandidateReponseType candidateResponseInfo,
                                      ClientCandidateWorkProfileCollection workProfiles)
 {
     using (new Loader(workProfiles))
     {
         if (candidateResponseInfo.WorkProfileInfos != null)
         {
             foreach (
                 ClientCandidateWorkProfileInfo workProfileInfo in candidateResponseInfo.WorkProfileInfos)
             {
                 ClientCandidateWorkProfile workProfile = workProfiles.AddNew();
                 workProfile.CompanyName = workProfileInfo.CompanyName;
             }
         }
     }
 }