private void StatusTest() { /* * Status field * */ //Valid values Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField(Fields.jmcg_testentity_.statuscode, Entities.jmcg_testentity, "Active")) == OptionSets.TestEntity.StatusReason.Active); Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField(Fields.jmcg_testentity_.statuscode, Entities.jmcg_testentity, OptionSets.TestEntity.StatusReason.Active)) == OptionSets.TestEntity.StatusReason.Active); Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField(Fields.jmcg_testentity_.statuscode, Entities.jmcg_testentity, XrmEntity.CreateOptionSet(OptionSets.TestEntity.StatusReason.Active))) == OptionSets.TestEntity.StatusReason.Active); try { var blah = XrmService.ParseField(Fields.jmcg_testentity_.statuscode, Entities.jmcg_testentity, "NOTASTATUS"); Assert.Fail(); } catch (Exception ex) { CheckException(ex); } }
private void StatusTest() { /* * Status field * */ //Valid values Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField("statuscode", Entities.jmcg_testentity, "Active")) == TestEntityConstants.Statusses.TestStatus); Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField("statuscode", Entities.jmcg_testentity, TestEntityConstants.Statusses.TestStatus)) == TestEntityConstants.Statusses.TestStatus); Assert.IsTrue( XrmEntity.GetOptionSetValue(XrmService.ParseField("statuscode", Entities.jmcg_testentity, XrmEntity.CreateOptionSet( TestEntityConstants.Statusses.TestStatus))) == TestEntityConstants.Statusses.TestStatus); try { var blah = XrmService.ParseField("statuscode", Entities.jmcg_testentity, "NOTASTATUS"); Assert.Fail(); } catch (Exception ex) { CheckException(ex); } }