Exemplo n.º 1
0
        /// <summary>
        /// Make some requests on the Department collection
        /// </summary>
        public static void DepartmentCollectionTest()
        {
            //Save a new document
            DepartmentRepository repository = new DepartmentRepository();
            var obj = Factory.CreateDepartment();

            Task.Run(async() => await repository.SaveAsync(obj))
            .GetAwaiter().GetResult();

            //Find all documents
            var docs = Task.Factory.StartNew(async() => await repository.FindAllAsync())
                       .GetAwaiter().GetResult().Result;

            foreach (var doc in docs)
            {
                Console.WriteLine(doc.ToJson());
            }
        }