YesSql.Tests.CoreTests.RemovingDocumentShouldDeleteMappedIndex C# (CSharp) Method

RemovingDocumentShouldDeleteMappedIndex() private method

private RemovingDocumentShouldDeleteMappedIndex ( ) : Task
return Task
        public async Task RemovingDocumentShouldDeleteMappedIndex()
        {
            _store.RegisterIndexes<PersonIndexProvider>();

            var bill = new Person
            {
                Firstname = "Bill",
                Lastname = "Gates"
            };

            using (var session = _store.CreateSession())
            {
                session.Save(bill);
            }

            using (var session = _store.CreateSession())
            {
                var personByName = await session.QueryIndexAsync<PersonByName>().FirstOrDefault();
                Assert.NotNull(personByName);

                var person = await session.QueryAsync().For<Person>().FirstOrDefault();
                Assert.NotNull(person);

                session.Delete(person);
            }

            using (var session = _store.CreateSession())
            {
                var personByName = await session.QueryIndexAsync<PersonByName>().FirstOrDefault();
                Assert.Null(personByName);
            }
        }
CoreTests