public void SaveInvalidScriptTest()
        {
            using (var application = XpoInMemoryXafApplication.CreateInstance())
                using (var objectSpace = application.CreateObjectSpace())
                {
                    var collectionSource = new CollectionSource(objectSpace, typeof(DashboardDataExtract));
                    var listView         = new ListView(collectionSource, application, true);

                    var controller = application.CreateController <DashboardDataExtractController>();
                    controller.SetView(listView);

                    controller.Active.Clear();
                    controller.Active["Test"] = true;

                    var dataExtract = objectSpace.CreateObject <DashboardDataExtract>();
                    dataExtract.Script = "invalid script";

                    var exception = Assert.Throws <UserFriendlyException>(() => objectSpace.CommitChanges());

                    Assert.Empty(objectSpace.GetObjects <DashboardDataExtract>());
                }
        }
        public void ChainedPropertiesTest()
        {
            using (var application = XpoInMemoryXafApplication.CreateInstance())
                using (var objectSpace = application.CreateObjectSpace())
                {
                    for (int i = 1; i <= 10000; i++)
                    {
                        var objectWithReference = objectSpace.CreateObject <TestClassWithReference>();
                        var objectWithName      = objectSpace.CreateObject <TestClassWithName>();
                        objectWithName.Name             = $"Name {i}";
                        objectWithReference.NamedObject = objectWithName;
                        objectWithReference.Title       = $"Reference to {i}";
                    }
                    objectSpace.CommitChanges();

                    var list = new ScriptResultList(objectSpace.GetObjectsQuery <TestClassWithReference>(), application.TypesInfo);

                    PropertyDescriptorCollection dataListProperties = list.GetItemProperties(null);
                    var complexProperty = dataListProperties.Find(nameof(TestClassWithReference.NamedObject), false);
                    Assert.NotNull(complexProperty);
                    var nestedProperties = list.GetItemProperties(new[] { complexProperty });
                    Assert.Equal(2, nestedProperties.Count);
                }
        }
Exemplo n.º 3
0
 public void UpdateDataExtractCore(string dataExtractId)
 {
     using (var application = XpoInMemoryXafApplication.CreateInstance())
     {
     }
 }