Exemplo n.º 1
0
        public async Task ItemsDeleted_Type_TestAsync()
        {
            var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin);

            var typeFilter1  = new TypeFilter(TypeFlags.NotBeingEdited | TypeFlags.NotReferenced);
            var typeItem1    = (await typeFilter1.GetTypeAsync(dataBase)) as ITypeItem;
            var actualPath   = string.Empty;
            var expectedPath = typeItem1.Path;
            await typeContext.AddItemsDeletedEventHandlerAsync(TypeContext_ItemsDeleted);

            await typeItem1.DeleteAsync(authentication);

            Assert.AreEqual(expectedPath, actualPath);
            await typeContext.RemoveItemsDeletedEventHandlerAsync(TypeContext_ItemsDeleted);

            var typeFilter2 = new TypeFilter(TypeFlags.NotBeingEdited | TypeFlags.NotReferenced);
            var typeItem2   = (await typeFilter2.GetTypeAsync(dataBase)) as ITypeItem;
            await typeItem2.DeleteAsync(authentication);

            Assert.AreEqual(expectedPath, actualPath);

            void TypeContext_ItemsDeleted(object sender, ItemsDeletedEventArgs <ITypeItem> e)
            {
                var typeItem = e.Items.Single();

                actualPath = e.ItemPaths.Single();
            }
        }