コード例 #1
0
        public void FindAllViewPagedTest()
        {
            Assert.NotNull(dbc = new DBContext(settings.Database.ConnectionString, logger));
            ContactRepository contactRepos = new ContactRepository(settings, logger, dbc);
            CityRepository    cityRepos    = new CityRepository(settings, logger, dbc);

            IPager <Contact> contacts = contactRepos.FindAllView(new Pager <Contact>()
            {
                PageNbr = 1, PageSize = 5
            });

            Assert.NotEmpty(contacts.Entities);
            Assert.True(contacts.Entities.Count == 5);
            Assert.True(contacts.RowCount > 0);
            Assert.NotNull(contacts.Entities);
            Assert.NotNull(contacts.Entities.FirstOrDefault().City);
            Assert.NotNull(contacts.Entities.FirstOrDefault().City.State);
            IPager <City> cities = cityRepos.FindAllView(new Pager <City>()
            {
                PageNbr = 1, PageSize = 5
            });

            Assert.NotEmpty(cities.Entities);
            Assert.True(cities.Entities.Count == 5);
            Assert.True(cities.RowCount > 0);
            Assert.NotNull(cities.Entities);
            Assert.NotNull(cities.Entities.FirstOrDefault().State);

            dbc.Close();
        }
コード例 #2
0
        public async Task FindAllViewTest()
        {
            Assert.NotNull(dbc = new DBContext(settings.Database.ConnectionString, logger));
            ContactRepository contactRepos = new ContactRepository(settings, logger, dbc);
            CityRepository    cityRepos    = new CityRepository(settings, logger, dbc);

            ICollection <Contact> contacts = await contactRepos.FindAllView();

            Assert.NotEmpty(contacts);
            Assert.NotNull(contacts.FirstOrDefault().City);
            Assert.NotNull(contacts.FirstOrDefault().City.State);
            ICollection <City> cities = await cityRepos.FindAllView();

            Assert.NotEmpty(cities);
            Assert.NotNull(cities.FirstOrDefault().State);

            dbc.Close();
        }