Esempio n. 1
0
        public void RepositoryTestGetById()
        {
            var mock = new Mock <IRepository <PDomain.Person> >();

            mock.Setup(a => a.GetByID(persone.ID)).Returns(persone);
            PersonServices  service      = new PersonServices(mock.Object);
            PersonViewModel p            = service.ToViewModel(persone);
            PersonViewModel personResult = service.GetById(persone.ID);

            Assert.AreEqual(p.ToString(), personResult.ToString());///
        }
Esempio n. 2
0
        public void RepositoryTestCrate()
        {
            var mock = new Mock <IRepository <PDomain.Person> >();

            mock.Setup(a => a.Create(persone));
            mock.Setup(a => a.GetByID(persone.ID)).Returns(persone);
            PersonServices  service = new PersonServices(mock.Object);
            PersonViewModel p       = service.ToViewModel(persone);

            service.Add(p);
            PersonViewModel personSavedVM = service.GetById(persone.ID);

            PDomain.Person personSaved = service.FromViewModel(personSavedVM);
            Assert.AreEqual(personSavedVM.ToString(), p.ToString());
            Assert.AreEqual(personSaved.ToString(), persone.ToString());
        }