public void SelectEconomicActivityByIdWithoutChildren() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = null }; activity.Id = _economicActivityManager.AddEconomicActivity(activity); Assert.AreNotEqual(0, activity.Id); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activity.Id); Assert.AreEqual(activity.Id,selectedActivity.Id); Assert.AreEqual("Services",selectedActivity.Name); Assert.AreEqual(false, selectedActivity.HasChildrens); Assert.AreEqual(0,selectedActivity.Childrens.Count); }
public void UpdateEconomicActivity() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = null }; activity.Id = _economicActivityManager.AddEconomicActivity(activity); activity.Name = "NewServices"; activity.Deleted = true; _economicActivityManager.UpdateEconomicActivity(activity); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activity.Id); Assert.AreEqual(activity.Id, selectedActivity.Id); Assert.AreEqual("NewServices", selectedActivity.Name); Assert.AreEqual(true, selectedActivity.Deleted); }
public void SelectEconomicActivityByIdWithChildren() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activityParent = new EconomicActivity { Name = "Services", Parent = null }; activityParent.Id = _economicActivityManager.AddEconomicActivity(activityParent); EconomicActivity activityA = new EconomicActivity { Name = "ServicesA", Parent = activityParent, }; activityA.Id = _economicActivityManager.AddEconomicActivity(activityA); EconomicActivity activityB = new EconomicActivity { Name = "ServicesB", Parent = activityParent, }; activityB.Id = _economicActivityManager.AddEconomicActivity(activityB); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activityParent.Id); Assert.AreEqual(activityParent.Id, selectedActivity.Id); Assert.AreEqual("Services", selectedActivity.Name); Assert.AreEqual(true, selectedActivity.HasChildrens); Assert.AreEqual(2, selectedActivity.Childrens.Count); Assert.AreEqual(false, selectedActivity.Deleted); }