public void CanEditContactWithSameEmail()
        {
            DistributorRepository dRepos = new DistributorRepository(Config.GrundfosFactoryConfigPath);
            DistributorController dc     = new DistributorController(dRepos);

            Contact c = dc.EditContact(2, 4, "emi Repo", "gali repo", "emirepeat@hot");

            c = dc.EditContact(2, 3, "emi Repeat", "gali repeat", "cambioelmail@hot");
            c = dc.EditContact(2, 3, "emi Repeat", "gali repeat", "emirepeat@hot");
        }
Exemple #2
0
        public void CanEditContact()
        {
            MockRepository         mock        = new MockRepository();
            IDistributorRepository mockedRepos = mock.CreateMock <IDistributorRepository>();

            Distributor expDistributor = new Distributor();

            expDistributor.Address  = "pepe street.";
            expDistributor.Code     = "1234";
            expDistributor.Discount = 15;
            expDistributor.Email    = "*****@*****.**";
            expDistributor.Name     = "testing Distributor";
            Contact expC = new Contact("Gali", "Emi", "*****@*****.**");

            expC.Distributor = expDistributor;
            expDistributor.Contacts.Add(expC);

            Contact contact = new Contact("Emi Cambiado", "Gali cambiado", "*****@*****.**");

            contact.Distributor = expDistributor;

            Expect.Call(mockedRepos.GetById(5)).Return(expDistributor).Repeat.AtLeastOnce();
            Expect.Call(mockedRepos.SaveContact(expC)).Return(contact);
            mockedRepos.CommitChange();
            LastCall.On(mockedRepos);
            mock.ReplayAll();
            DistributorController dc = new DistributorController(mockedRepos);

            Contact c = dc.EditContact(5, 0, "Emi Cambiado", "Gali cambiado", "*****@*****.**");

            Assert.AreNotEqual("Emi", c.Name);
            Assert.AreEqual("Gali cambiado", c.LastName);
            Assert.AreNotEqual("*****@*****.**", c.Email);
        }
        public void CanEditContact()
        {
            DistributorRepository dRepos = new DistributorRepository(Config.GrundfosFactoryConfigPath);
            DistributorController dc     = new DistributorController(dRepos);

            Contact c = dc.EditContact(2, 3, "emi Repo", "gali repo", "emirepo@hot");

            Assert.AreEqual(c.Name, "emi Repo");
        }
Exemple #4
0
        public void CanEditContact()
        {
            MockRepository         mock        = new MockRepository();
            IDistributorRepository mockedRepos = mock.CreateMock <IDistributorRepository>();

            Contact contact = new Contact("Gali", "Emi", "*****@*****.**");

            Expect.Call(mockedRepos.GetContactById(1)).Return(contact);
            Expect.Call(mockedRepos.SaveContact(contact)).Return(contact);
            mockedRepos.CommitChanges();
            LastCall.On(mockedRepos);
            mock.ReplayAll();
            DistributorController dc = new DistributorController(mockedRepos);

            Contact c = dc.EditContact(1, "Emi Cambiado", "Gali cambiado", "*****@*****.**");

            Assert.AreNotEqual("Emi", c.Name);
            Assert.AreEqual("Gali cambiado", c.LastName);
            Assert.AreNotEqual("*****@*****.**", c.Email);
        }