Exemple #1
0
        public void TestDeleteForeignObjectKeyEntities()
        {
            E.Test testKey = Assert.ScriptCalled(_databaseFixture, Query.Select, () => _databaseFixture.ObjectProvider.GetQueryable <E.Test>().ForceLoad().ToList()).Where(x => x.Id == 1).First();

            E.ForeignObjectKey entity = _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x.Test == testKey).FirstOrDefault();
            Assert.NotNull(entity);
            _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x == entity).Delete();

            Assert.ScriptCalled(_databaseFixture, Query.DeleteForeignObjectKeyEntity, () => _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x == entity).Save());
        }
Exemple #2
0
        public void TestUpdateForeignObjectKeyEntities()
        {
            E.Test testKey = Assert.ScriptCalled(_databaseFixture, Query.Select, () => _databaseFixture.ObjectProvider.GetQueryable <E.Test>().ForceLoad().ToList()).Where(x => x.Id == 1).First();
            string text    = FirstRandomText;

            _databaseFixture.SetResult(Query.UpdateForeignObjectKeyEntity, new[] { new object[] { testKey.Id, text } });

            E.ForeignObjectKey entity = _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x.Test == testKey).ForceLoad().FirstOrDefault();
            Assert.NotNull(entity);
            entity.Value = text;

            Assert.ScriptCalled(_databaseFixture, Query.UpdateForeignObjectKeyEntity, () => _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x == entity).Save());
        }
Exemple #3
0
        public void TestInsertForeignObjectKeyChainEntity()
        {
            E.Test             testKey          = Assert.ScriptCalled(_databaseFixture, Query.Select, () => _databaseFixture.ObjectProvider.GetQueryable <E.Test>().ForceLoad().ToList()).Where(x => x.Id == 1).First();
            E.SubTest          subTestKey       = _subQueryable.Where(x => x.Test == testKey).ToList().FirstOrDefault();
            E.ForeignObjectKey foreignObjectKey = Assert.ScriptCalled(_databaseFixture, Query.SelectForeignObjectKeyEntity, () => _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKey>().Where(x => x.Test == testKey).ForceLoad().ToList()).First();
            string             text             = FirstRandomText;

            _databaseFixture.SetResult(Query.InsertForeignObjectKeyChainEntity, new[] { new object[] { foreignObjectKey.Test.Id, subTestKey.Id, text } });

            E.ForeignObjectKeyChain entity = _databaseFixture.ObjectProvider.CreateObject <E.ForeignObjectKeyChain>();
            Assert.NotNull(entity);
            entity.ForeignObjectKey = foreignObjectKey;
            entity.SubTest          = subTestKey;
            entity.Value            = text;

            Assert.ScriptCalled(_databaseFixture, Query.InsertForeignObjectKeyChainEntity, () => _databaseFixture.ObjectProvider.GetQueryable <E.ForeignObjectKeyChain>().Where(x => x == entity).Save());
        }