Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public void Test_New()
        {
            ClientCandidate candidate = new ClientCandidate();

            Assert.IsTrue(candidate.IsNew);
            Assert.IsTrue(candidate.IsDirty);
            Assert.IsFalse(candidate.IsDeleted);

            Assert.IsTrue(candidate.IsValid);
            Assert.IsTrue(candidate.IsSavable);
            Assert.IsTrue(candidate.CanSave());
            Assert.AreEqual(candidate.Version, 0);

            Assert.IsTrue(candidate.IsDraft);
            Assert.IsFalse(candidate.IsActive);
            Assert.IsFalse(candidate.IsArchived);
            Assert.IsFalse(candidate.IsAlive);

            Assert.IsNull(candidate.Parent);
            Assert.IsFalse(candidate.IsChild);

            Assert.IsNotNull(candidate.WorkProfiles);
            Assert.AreEqual(candidate.WorkProfiles.Count, 0);

            //Assert.IsNull(candidate.Contact);
        }
        private void ButtonGetAll_Click(object sender, EventArgs e)
        {
            int i = 0;

            comboBoxGetAll.Items.Clear();
            CheckedListBoxLangages.Items.Clear();
            dataGridViewMatches.Rows.Clear();
            List <Candidate> .Enumerator liste = ClientCandidate.CallGetAll().GetEnumerator();
            ComboBoxItem item = null;

            while (liste.MoveNext())
            {
                item = new ComboBoxItem
                {
                    Text    = liste.Current.ToString(),
                    Value   = liste.Current.Id,
                    Langage = liste.Current.Langages
                };
                comboBoxGetAll.Items.Add(item);
                i++;
            }
            if (i >= 1)
            {
                buttonLangages.Enabled       = true;
                buttonChercherPostes.Enabled = false;
            }
            comboBoxGetAll.SelectedIndex = 0;
        }
Beispiel #5
0
        public void Test_Authorization()
        {
            ClientCandidate candidate = new ClientCandidate();

            Assert.IsTrue(candidate.CanReadProperty("Name"));
            Assert.IsTrue(candidate.CanReadProperty("IsFresher"));
            Assert.IsTrue(candidate.CanReadProperty("DateOfApplication"));

            Assert.IsTrue(candidate.CanWriteProperty("Name"));
            Assert.IsTrue(candidate.CanWriteProperty("IsFresher"));
            Assert.IsTrue(candidate.CanWriteProperty("DateOfApplication"));
        }
Beispiel #6
0
        public static ClientCandidate ServiceToBusiness(CandidateReponseType candidateResponseInfo)
        {
            ClientCandidate candidate = new ClientCandidate();

            if (candidateResponseInfo.CandidateInfoLoaded)
            {
                ServiceToBusiness(candidateResponseInfo, candidate);
            }

            if (candidateResponseInfo.WorkProfileInfoLoaded)
            {
                ServiceToBusiness(candidateResponseInfo, candidate.WorkProfiles);
            }

            if (candidateResponseInfo.ContatInfoLoaded)
            {
                ServiceToBusiness(candidateResponseInfo, candidate.Contact);
            }
            return(candidate);
        }
Beispiel #7
0
        public void Test_Undo()
        {
            ClientCandidate candidate         = new ClientCandidate();
            string          name              = "Name";
            bool            isFresher         = true;
            DateTime?       dateOfApplication = DateTime.Now;

            candidate.Name              = name;
            candidate.IsFresher         = isFresher;
            candidate.DateOfApplication = dateOfApplication;

            candidate.BeginEdit();

            candidate.Name             += "Changed ";
            candidate.IsFresher         = !candidate.IsFresher;
            candidate.DateOfApplication = DateTime.Now;

            candidate.CancelEdit();


            Assert.AreEqual(candidate.Name, name);
            Assert.AreEqual(candidate.IsFresher, isFresher);
            Assert.AreEqual(candidate.DateOfApplication, dateOfApplication);
        }
Beispiel #8
0
        public static void ServiceToBusiness(CandidateReponseType candidateResponseInfo, ClientCandidate candidate)
        {
            using (new Loader(candidate))
            {
                if (candidateResponseInfo.CandidateInfo != null)
                {
                    candidate.Name      = candidateResponseInfo.CandidateInfo.Name;
                    candidate.IsFresher = candidateResponseInfo.CandidateInfo.IsFresher;

                    candidate.DateOfApplication =
                        DateTimeHelper.SafeConvert(candidateResponseInfo.CandidateInfo.DateOfApplication);
                }
            }
        }
Beispiel #9
0
 public void Test_LoadCandidateFull()
 {
     ClientCandidate candidate = CandidateRepository.LoadCandidateFull();
 }
Beispiel #10
0
 public void Test_LoadCandidateAndNullWorkProfile()
 {
     ClientCandidate candidate = CandidateRepository.LoadCandidateAndNullWorkProfile();
 }
Beispiel #11
0
 public void Test_LoadCandidateAndNullContact()
 {
     ClientCandidate candidate = CandidateRepository.LoadCandidateAndNullContact();
 }