コード例 #1
0
        public async Task Sorts_MobilePhone_descending(
            [Frozen, Greedy] EmployeeContext db,
            Employee[] employees,
            QueryEmployees request,
            QueryEmployeesHandler sut)
        {
            await db.Employees.AddRangeAsync(employees);

            await db.SaveChangesAsync();

            request.Sort = nameof(Employee.MobilePhone) + "_desc";

            var result = await sut.Handle(request);

            result.Should().BeInDescendingOrder(_ => _.MobilePhone);
        }
コード例 #2
0
        public async Task Filters_whose_LastName_contains_string(
            [Frozen, Greedy] EmployeeContext db,
            Employee[] employees,
            QueryEmployees request,
            QueryEmployeesHandler sut)
        {
            employees[0].LastName = employees[0].LastName.Insert(10, request.Search);
            await db.Employees.AddRangeAsync(employees);

            await db.SaveChangesAsync();

            request.Sort = nameof(Employee.MobilePhone) + "_desc";

            var result = await sut.Handle(request);

            result.Should().ContainSingle()
            .Which.Should().BeEquivalentTo(employees[0]);
        }