public void ActivateDeactivate() { MockRepository mock = new MockRepository(); IDistributorRepository repository = mock.CreateMock <IDistributorRepository>(); Distributor d = new Distributor(); d.DistributorStatus = DistributorStatus.Active; Expect.Call(repository.GetById(1)).Return(d); mock.ReplayAll(); DistributorController distributorController = new DistributorController(repository); distributorController.ActivateDeactivate(1); Assert.AreEqual(DistributorStatus.Disable, d.DistributorStatus); }
public void CanChangeDistributorStatus() { DistributorRepository dRepos = new DistributorRepository(Config.GrundfosFactoryConfigPath); DistributorController dc = new DistributorController(dRepos); Distributor d = dc.GetById(2); string initialStatus = d.DistributorStatus.ToString(); dc.ActivateDeactivate(2); d = dc.GetById(2); if (initialStatus == DistributorStatus.Active.ToString()) { Assert.AreEqual(d.DistributorStatus, DistributorStatus.Disable); } else { Assert.AreEqual(d.DistributorStatus, DistributorStatus.Active); } }