Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Linq;
- using ETR.S7.Groups.AgentRequests.Dal;
- using Microsoft.EntityFrameworkCore;
- using Newtonsoft.Json;
- using Xunit;
- using Xunit.Abstractions;
- namespace ETR.S7.Groups.AgentRequests.Infrastructure.Tests
- {
- public class Test1
- {
- public Test1(ITestOutputHelper output)
- {
- _output = output;
- }
- private readonly ITestOutputHelper _output;
- private int Count(int? num)
- {
- return num.Value + 100;
- }
- [Fact]
- public void Play()
- {
- var options = new DbContextOptionsBuilder()
- .UseSqlServer("Server=mssql;Database=AgentRequests;User=sa;Password=yourStrong(!)Password;")
- .Options;
- var appRepository = new AppRepository(options);
- var agentRequests = appRepository.AgentRequests
- .Select(x => new {
- x.Route,
- Test = Count(x.Route.PaxCount)
- })
- .Where(x => x.Test > 10)
- .Where(x => x.Route.PaxCount > 10)
- .Select(x => new {
- x.Route.BookingNumber,
- Test = Count(x.Test)
- })
- .ToList();
- _output.WriteLine(JsonConvert.SerializeObject(agentRequests, Formatting.Indented));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement