public async Task ItemsDeleted_TestAsync() { var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin); var actualDataBaseName = string.Empty; var actualComment = string.Empty; var datatBaseFilter1 = new DataBaseFilter(DataBaseFlags.NotLoaded | DataBaseFlags.Public | DataBaseFlags.NotLocked); var dataBase1 = await datatBaseFilter1.GetDataBaseAsync(app); var datatBaseFilter2 = new DataBaseFilter(DataBaseFlags.NotLoaded | DataBaseFlags.Public | DataBaseFlags.NotLocked) { ExcludedDataBaseNames = new[] { dataBase1.Name } }; var dataBase2 = await datatBaseFilter2.GetDataBaseAsync(app); var dataBaseName1 = dataBase1.Name; var dataBaseName2 = dataBase2.Name; var expectedDataBaseName = dataBase1.Name; var expectedComment = dataBase1.DataBaseInfo.Comment; await dataBaseContext.AddItemsDeletedEventHandlerAsync(DataBaseContext_ItemsDeleted); await dataBase1.DeleteAsync(authentication); Assert.AreEqual(expectedDataBaseName, actualDataBaseName); Assert.AreEqual(expectedComment, actualComment); Assert.IsFalse(await dataBaseContext.ContainsAsync(dataBaseName1)); await dataBaseContext.RemoveItemsDeletedEventHandlerAsync(DataBaseContext_ItemsDeleted); await dataBase2.DeleteAsync(authentication); Assert.AreEqual(expectedDataBaseName, actualDataBaseName); Assert.AreEqual(expectedComment, actualComment); Assert.IsFalse(await dataBaseContext.ContainsAsync(dataBaseName2)); void DataBaseContext_ItemsDeleted(object sender, ItemsDeletedEventArgs <IDataBase> e) { var dataBase = e.Items.Single() as IDataBase; var dataBaseInfo = dataBase.DataBaseInfo; actualDataBaseName = dataBaseInfo.Name; actualComment = dataBaseInfo.Comment; } }