public void TestCreate() { IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>(); OrganizationTypeDetailPanel page = new OrganizationTypeDetailPanel(); DetailPanelPageProxy proxy = new DetailPanelPageProxy(page); using (var httpEnv = new HttpEnvironment()) { httpEnv.SetRequestUrl(@"/OrganizationTypeDetailPanel/DynamicPage.svc?Domain=Department"); #region bind web control Guid guid = Guid.NewGuid(); string surfix = guid.ToString().Substring(0, 5); RapidWebDev.UI.Controls.TextBox TextBoxName = new RapidWebDev.UI.Controls.TextBox(); TextBoxName.Text = "OrganizationTypeTest" + surfix; proxy.Set("TextBoxName", TextBoxName); RapidWebDev.UI.Controls.TextBox TextBoxDescription = new RapidWebDev.UI.Controls.TextBox(); TextBoxDescription.Text = "OrganizationTypeTest" + surfix; proxy.Set("TextBoxDescription", TextBoxDescription); proxy.Set("DropDownListDomain", null); #endregion string entityId = proxy.Create(); ids.Add(new Guid(entityId)); Assert.AreEqual(organizationApi.GetOrganizationType(new Guid(entityId)).Description, "OrganizationTypeTest" + surfix); } }
public void TestUpdate() { IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>(); OrganizationTypeDetailPanel page = new OrganizationTypeDetailPanel(); DetailPanelPageProxy proxy = new DetailPanelPageProxy(page); using (var httpEnv = new HttpEnvironment()) { httpEnv.SetRequestUrl(@"/OrganizationTypeDetailPanel/DynamicPage.svc?Domain=Department"); #region Create Data Guid guid = Guid.NewGuid(); string surfix = guid.ToString().Substring(0, 5); OrganizationTypeObject obj = new OrganizationTypeObject() { Name = "OrganizationTypeTestUpdate" + surfix, Description = "OrganizationTypeTest" + surfix, Predefined = false, Domain = "Department", DeleteStatus = DeleteStatus.NotDeleted }; organizationApi.Save(obj); ids.Add(obj.OrganizationTypeId); #endregion #region Bind Web Control RapidWebDev.UI.Controls.TextBox TextBoxName = new RapidWebDev.UI.Controls.TextBox(); TextBoxName.Text = "OrganizationTypeTestUpdate" + surfix; proxy.Set("TextBoxName", TextBoxName); RapidWebDev.UI.Controls.TextBox TextBoxDescription = new RapidWebDev.UI.Controls.TextBox(); TextBoxDescription.Text = "OrganizationTypeTestUpdate" + surfix; proxy.Set("TextBoxDescription", TextBoxDescription); DropDownList DropDownListDomain = new DropDownList(); var typeData = new string[] { "Department" }; DropDownListDomain.DataSource = typeData; DropDownListDomain.DataBind(); DropDownListDomain.SelectedIndex = 0; proxy.Set("DropDownListDomain", DropDownListDomain); #endregion proxy.Update(obj.OrganizationTypeId.ToString()); Assert.AreEqual(obj.Description, "OrganizationTypeTest" + surfix); obj = organizationApi.GetOrganizationType(obj.OrganizationTypeId); Assert.AreEqual(obj.Description, "OrganizationTypeTestUpdate" + surfix); } }