예제 #1
0
        public async Task ItemsAccessChanged_TestAsync()
        {
            var authenticaiton = await this.TestContext.LoginRandomAsync(Authority.Admin);

            var dataBaseFilter = new DataBaseFilter(DataBaseFlags.Loaded | DataBaseFlags.Public | DataBaseFlags.NotLocked);
            var dataBase       = await dataBaseFilter.GetDataBaseAsync(app);

            var actualValue = dataBase.AccessInfo.IsPublic;

            await dataBaseContext.AddItemsAccessChangedEventHandlerAsync(DataBaseContext_ItemsAccessChanged);

            await dataBase.SetPrivateAsync(authenticaiton);

            Assert.IsFalse(actualValue);

            await dataBaseContext.RemoveItemsAccessChangedEventHandlerAsync(DataBaseContext_ItemsAccessChanged);

            await dataBase.SetPublicAsync(authenticaiton);

            Assert.IsFalse(actualValue);

            void DataBaseContext_ItemsAccessChanged(object sender, ItemsEventArgs <IDataBase> e)
            {
                var dataBase = e.Items.Single() as IDataBase;

                actualValue = dataBase.AccessInfo.IsPublic;
            }
        }