示例#1
0
        public void JobOfferQueryObjectTest()
        {
            var unit = new UnitOfWork(GetInMemoryOptions());

            Seeder.Seed(unit);

            unit.CompanyQuery.FilterByName("Apple");
            var apple = unit.CompanyQuery.ExecuteAsync().Result.First();

            var queryObject = new JobOfferQueryObject(unit);

            Assert.Equal(new List <string>()
            {
                "Cybertruck driving software development at Tesla",
                "Software development at Apple"
            },
                         queryObject.GetByNameContainsAsync("oftware")
                         .Result
                         .Select(o => o.Name));

            Assert.Equal(2, queryObject.GetByCompanyNameAsync("Apple")
                         .Result
                         .Count());

            Assert.Equal(new List <string>()
            {
                "Developing new .NET Core SDK",
                "Well-paid position at Apple"
            },
                         queryObject.GetBySkillTagAsync("C#")
                         .Result
                         .Select(o => o.Name));

            Assert.Equal(new List <string>()
            {
                "Developing new .NET Core SDK",
                "Pouring coffee and writing names on cups"
            },
                         queryObject.GetByCityAsync("Seattle")
                         .Result
                         .Select(o => o.Name));
            unit.Dispose();
        }
示例#2
0
 public async Task <IEnumerable <JobOffer> > GetByCityAsync(string city, bool ascendingOrder = true)
 {
     return(await jobOfferQueryObject.GetByCityAsync(city, ascendingOrder));
 }