public void EducationRepository_Add_Exception3()
        {
            EducationEntity ee      = null; // bad!
            var             mockXml = new Mock <IEducationXMLService>();

            mockXml.Setup(T => T.Insert(ee)).Throws <ArgumentNullException>();
            var repos = new EducationRepository(mockXml.Object);

            repos.Add(ee);

            Assert.IsTrue(true);
        }
        public void EducationRepository_Add_Exception1()
        {
            EducationEntity ee = new EducationEntity();

            ee.Credential  = null; // bad!
            ee.Institution = "test institution";
            var mockXml = new Mock <IEducationXMLService>();

            mockXml.Setup(T => T.Insert(ee)).Throws <ArgumentException>();
            var repos = new EducationRepository(mockXml.Object);

            repos.Add(ee);

            Assert.IsTrue(true);
        }
        public void EducationRepository_Add_Works()
        {
            EducationEntity ee = new EducationEntity();

            ee.Credential  = "test credential";
            ee.Institution = "test institution";
            var mockXml = new Mock <IEducationXMLService>();

            mockXml.Setup(T => T.Insert(ee));
            var repos = new EducationRepository(mockXml.Object);

            var id = repos.Add(ee);

            Assert.IsInstanceOfType(id, typeof(Guid));
            Assert.IsNotNull(id);
        }
예제 #4
0
 public ActionResult AddEducation(Education education)
 {
     repository.Add(education);
     return(RedirectToAction("Index"));
 }