public void TestEnumToMutableDocument() { var simpleObject = new SimpleObjectWithEnum { SimpleEnum = SimpleEnum.Enum_2 }; var mutableDocument = simpleObject.ToMutableDocument(); var result = mutableDocument.Keys.Contains("SimpleEnum"); var enumValue = mutableDocument.GetString("SimpleEnum"); Assert.True(result, "Property Name is not getting converted correctly."); Assert.Equal("EnumValue_2", enumValue); }
public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); Position developerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Developer'")); if (developerPosition == null) { developerPosition = ObjectSpace.CreateObject <Position>(); developerPosition.Title = "Developer"; } Position managerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Manager'")); if (managerPosition == null) { managerPosition = ObjectSpace.CreateObject <Position>(); managerPosition.Title = "Manager"; } Contact contactJohn = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'John' && LastName == 'Nilsen'")); if (contactJohn == null) { contactJohn = ObjectSpace.CreateObject <Contact>(); contactJohn.FirstName = "John"; contactJohn.LastName = "Nilsen"; contactJohn.Email = "*****@*****.**"; contactJohn.Birthday = new DateTime(1981, 10, 3); contactJohn.Position = developerPosition; } PhoneNumber johnPhoneNumber_1 = ObjectSpace.FindObject <PhoneNumber>(CriteriaOperator.Parse("Number == '888-111-222'")); if (johnPhoneNumber_1 == null) { johnPhoneNumber_1 = ObjectSpace.CreateObject <PhoneNumber>(); johnPhoneNumber_1.Number = "888-111-222"; contactJohn.PhoneNumbers.Add(johnPhoneNumber_1); } PhoneNumber johnPhoneNumber_2 = ObjectSpace.FindObject <PhoneNumber>(CriteriaOperator.Parse("Number == '888-333-222'")); if (johnPhoneNumber_2 == null) { johnPhoneNumber_2 = ObjectSpace.CreateObject <PhoneNumber>(); johnPhoneNumber_2.Number = "888-333-222"; contactJohn.PhoneNumbers.Add(johnPhoneNumber_2); } ObjectSpace.CommitChanges(); Contact contactMary = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'Mary' && LastName == 'Tellitson'")); if (contactMary == null) { contactMary = ObjectSpace.CreateObject <Contact>(); contactMary.FirstName = "Mary"; contactMary.LastName = "Tellitson"; contactMary.Email = "*****@*****.**"; contactMary.Birthday = new DateTime(1980, 11, 27); contactMary.Position = managerPosition; } PhoneNumber maryPhoneNumber_1 = ObjectSpace.FindObject <PhoneNumber>(CriteriaOperator.Parse("Number == '999-999-999'")); if (maryPhoneNumber_1 == null) { maryPhoneNumber_1 = ObjectSpace.CreateObject <PhoneNumber>(); maryPhoneNumber_1.Number = "999-999-999"; contactMary.PhoneNumbers.Add(maryPhoneNumber_1); } PhoneNumber maryPhoneNumber_2 = ObjectSpace.FindObject <PhoneNumber>(CriteriaOperator.Parse("Number == '999-999-777'")); if (maryPhoneNumber_2 == null) { maryPhoneNumber_2 = ObjectSpace.CreateObject <PhoneNumber>(); maryPhoneNumber_2.Number = "999-999-777"; contactMary.PhoneNumbers.Add(maryPhoneNumber_2); } ObjectSpace.CommitChanges(); Company myOrg = ObjectSpace.FindObject <Company>(CriteriaOperator.Parse("Name == 'Demo Company'")); if (myOrg == null) { myOrg = ObjectSpace.CreateObject <Company>(); myOrg.Name = "Demo Company"; myOrg.City = "DefaultCity"; } #if !DXCORE3 CreateReport("OrdinalReport", OrdinalReportResource.ReportLayout, "ReportWithParametersObject", typeof(DemoParameters)); ReportDataV2 reportData = CreateReport("SubreportCompany", SubreportCompanyLayout.ReportLayout); string reportWithSubReportLayout = ReportWithSubReportLayout.ReportLayout.Replace("SubReportKEY", ObjectSpace.GetObjectHandle(reportData)); ReportDataV2 simpleSubReportData = CreateReport("SimpleSubReport", SimpleSubReportLayout.ReportLayout); string reportWithSubReportDifferentEnumsLayout = ReportWithSubReportDifferentEnumsLayout.ReportLayout.Replace("SubReportKEY", ObjectSpace.GetObjectHandle(simpleSubReportData)); CreateReport("ReportWithSecurity", ReportWithSecurity.ReportLayout); CreateReport("ReportWithSubReportDifferentEnums", reportWithSubReportDifferentEnumsLayout); CreateReport("ReportWithSubReport", reportWithSubReportLayout); CreateReport("ReportWithViewDataSource", ReportWithViewDataSourceLayout.ReportLayout); CreateReport("OrdinalReport", OrdinalReportResource.ReportLayout); #else CreateReport("OrdinalReport", "OrdinalReport.repx"); CreateReport("ReportWithSecurity", "ReportWithSecurity.repx"); CreateReport("OrdinalReport", "OrdinalReport.repx", "ReportWithParametersObject", typeof(DemoParameters)); ReportDataV2 simpleSubReportData = CreateReport("SimpleSubReport", "SimpleSubReport.repx"); CreateReport("ReportWithSubReportDifferentEnums", "ReportWithSubReportDifferentEnums.repx", subReportUrl: ObjectSpace.GetObjectHandle(simpleSubReportData)); ReportDataV2 reportData = CreateReport("SubreportCompany", "SubreportCompany.repx"); CreateReport("ReportWithSubReport", "ReportWithSubReport.repx", subReportUrl: ObjectSpace.GetObjectHandle(reportData)); CreateReport("ReportWithViewDataSource", "ReportWithViewDataSource.repx"); #endif CreateReportParameters(); CreateReportMultiValueParameters(); CreateReportWithBookmark(); CreateUser(); SimpleObjectWithEnum simpleObjectWithEnum = ObjectSpace.FindObject <SimpleObjectWithEnum>(CriteriaOperator.Parse("Name == 'One'")); if (simpleObjectWithEnum == null) { simpleObjectWithEnum = ObjectSpace.CreateObject <SimpleObjectWithEnum>(); simpleObjectWithEnum.Name = "One"; simpleObjectWithEnum.SimpleEnum = SimpleEnum.One; } ObjectWithSecurity objectWithSecurity = ObjectSpace.FindObject <ObjectWithSecurity>(new BinaryOperator("Name", "TestObject")); if (objectWithSecurity == null) { objectWithSecurity = ObjectSpace.CreateObject <ObjectWithSecurity>(); objectWithSecurity.Name = "TestObject"; PermissionPolicyUser user = ObjectSpace.FindObject <PermissionPolicyUser>(new BinaryOperator("UserName", "User")); objectWithSecurity.User = user; } ObjectSpace.CommitChanges(); }