示例#1
0
        public void TestAddCandidateAndProjectTogether()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Mohan";
            CandidateProject project = new CandidateProject();

            project.Name = "ResumePro";
            candidate.AddProject(project);

            candidate = SaveAndReFetch(candidate);

            Assert.AreEqual(candidate.Projects.Count, 1);
        }
示例#2
0
        public ActionResult AddCandidateProject(CandidateProject cp)
        {
            ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email");
            string id = User.Identity.GetUserId();

            cp.UserId = id;

            if (cp.Id > 0)
            {
                db.Entry(cp).State = EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                db.CandidateProjects.Add(cp);
                db.SaveChanges();
            }
            return(View(cp));
        }
示例#3
0
        public void TestRemoveProjectDirect()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Palaksha";
            CandidateProject project = new CandidateProject();

            project.Name = "AppServer";
            candidate.AddProject(project);
            Save(candidate);

            project = Repository <CandidateProject> .FindOne(Expression.Eq("Name", "AppServer"));

            candidate.RemoveProject(project);

            SaveAndReFetch(candidate);

            Assert.AreEqual(candidate.Projects.Count, 0);
        }
示例#4
0
        public void TestUpdateProjectDirect()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Palaksha";
            CandidateProject project = new CandidateProject();

            project.Name = "AppServer";
            candidate.AddProject(project);
            Save(candidate);


            project = Repository <CandidateProject> .FindOne(Expression.Eq("Name", "AppServer"));

            project.Name = "Changed" + project.Name;


            project = Collection.First(candidate.Projects);
            Assert.IsTrue(project.Name.StartsWith("Changed"));
        }
示例#5
0
        public void TestUpdateProject()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Palaksha";
            CandidateProject project = new CandidateProject();

            project.Name = "AppServer";
            candidate.AddProject(project);

            candidate    = SaveAndReFetch(candidate);
            project      = Collection.First(candidate.Projects);
            project.Name = "Changed" + project.Name;


            candidate = SaveAndReFetch(candidate);

            project = Collection.First(candidate.Projects);
            Assert.IsTrue(project.Name.StartsWith("Changed"));
        }
示例#6
0
        public void TestAddCandidateAndWorkProfileAndProject()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Mohan";

            CandidateWorkProfile workProfile;

            Relation.AddNew(candidate, out workProfile);
            workProfile.CompanyName = "HirePro";

            CandidateProject project = new CandidateProject();

            project.Name = "ResumePro";
            Relation.Add(workProfile, project);

            candidate = SaveAndReFetch(candidate);

            Assert.AreEqual(Relation.Count <CandidateWorkProfile>(candidate), 1);
            Assert.AreEqual(Relation.Count <CandidateProject>(workProfile), 1);
            Assert.AreEqual(
                CollectionHelper.First(Relation.Collection <CandidateProject>(workProfile)).Name,
                "ResumePro");
        }
示例#7
0
        public void TestRemoveProject()
        {
            TestCandidate candidate = new TestCandidate();

            candidate.Name = "Palaksha";

            CandidateProject project = new CandidateProject();

            project.Name = "AppServer";
            candidate.AddProject(project);

            candidate = SaveAndReFetch(candidate);

            project = Collection.First(candidate.Projects);

            With.Transaction(delegate
            {
                candidate.RemoveProject(project);
            });

            candidate = SaveAndReFetch(candidate);

            Assert.AreEqual(candidate.Projects.Count, 0);
        }