Esempio n. 1
0
        public async Task Create_Initial_Data_From_IT_Store_API()
        {
            IFetchSeedData seedData = new ItbookStoreSeedApi();
            var            books    = await seedData.FetchSeedData();

            books.Count().Should().Be(10);
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            IFetchSeedData seedData = new ItbookStoreSeedApi();
            var            books    = seedData.FetchSeedData().Result;

            services.AddSingleton <IDocumentStore>(DocumentStore.For(_ =>
            {
                _.Connection("host=localhost;database=BookStore;password=password;username=postgres");
                _.InitialData.Add(new InitialDataLoad(books.ToArray()));
            }));
        }
Esempio n. 3
0
        public async Task Verify_If_the_Data_Is_available_After_the_Store_Creation()
        {
            var pDocumentStore = DocumentStore.For(_ =>
            {
                _.Connection("host=localhost;database=BookStore;password=password;username=postgres");
            });

            pDocumentStore.Advanced.Clean.DeleteAllDocuments();
            IFetchSeedData seedData = new ItbookStoreSeedApi();
            var            books    = await seedData.FetchSeedData();

            var store = DocumentStore.For(_ =>
            {
                _.Connection("host=localhost;database=BookStore;password=password;username=postgres");
                _.InitialData.Add(new InitialDataLoad(books.ToArray()));
            });

            using (var query = store.QuerySession())
            {
                var count = await query.Query <Book>().CountAsync();

                count.Should().Be(10);
            }
        }