private List<UserModelDifferenceObject> GetUserStoreObject()
        {
            var objects = new List<UserModelDifferenceObject>();
            var userStoreObject = new UserModelDifferenceObject(Session.DefaultSession) { PersistentApplication =new PersistentApplication(Session.DefaultSession) { UniqueName = "AppName" } };
            ((XPCollection)userStoreObject.GetMemberValue("Users")).Add(SecuritySystem.CurrentUser);
            userStoreObject.Save();
            objects.Add(userStoreObject);

            userStoreObject = new UserModelDifferenceObject(Session.DefaultSession) { PersistentApplication = new PersistentApplication(Session.DefaultSession) { UniqueName = "AppName" } };
            ((XPCollection)userStoreObject.GetMemberValue("Users")).Add(SecuritySystem.CurrentUser);
            userStoreObject.Save();
            objects.Add(userStoreObject);
            return objects;
        }
예제 #2
0
        public void if_AspectObject_Is_Not_Persistent_WillNot_be_saved(bool nonPersistent)
        {
            var store = new XpoUserModelDictionaryDifferenceStore(Isolate.Fake.Instance<XafApplication>());

            var modelStoreObject = new UserModelDifferenceObject(Session.DefaultSession){
                                                                                            PersistentApplication = new PersistentApplication(Session.DefaultSession),
                                                                                            NonPersistent = nonPersistent
                                                                                        };
            Isolate.WhenCalled(() => modelStoreObject.Save()).WillThrow(new NotImplementedException());
            Isolate.WhenCalled(() => store.GetActiveDifferenceObject()).WillReturn(modelStoreObject);
            var dictionary = new Dictionary(Schema.GetCommonSchema());
            Isolate.WhenCalled(() => dictionary.Aspects).WillReturn(new List<string> { "aspect" });
            Isolate.Fake.StaticMethods(typeof(Validator));

            store.SaveDifference(dictionary);
        }