public void AndTest_PassThreeParameters_AssertParameter() { var employees = new E3SEntitySet <EmployeeEntity>(_fakeClient); foreach (var emp in employees.Where(e => e.workstation.Contains("EPRUIZHW0249") && e.workstation.StartsWith("E49") && e.workstation.EndsWith("EQW11"))) { Console.WriteLine("{0}", emp); } var expectedString = @"https://e3s.epam.com/eco/rest/e3s-eco-scripting-impl/0.1.0/data/searchFts?" + @"metaType=meta:people-suite:people-api:com.epam.e3s.app.people.api.data.EmployeeEntity&" + @"query={""statements"":[{""query"":""workstation:(*EQW11)""}%2c{""query"":""workstation:(*EPRUIZHW0249*)""}%2c{""query"":""workstation:(E49*)""}]%2c""filters"":null%2c""sorting"":null%2c""start"":0%2c""limit"":0}"; A.CallTo(() => _fakeClient.GetStringAsync(A <Uri> .That.Matches(uri => uri.ToString() == expectedString))).MustHaveHappened(); }
public void EndsWith() { var _mock = new Mock <E3SQueryClient>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); _mock.Setup(x => x.SearchFTS(It.IsAny <Type>(), "workstation:(*IZHW0060)", It.IsAny <int>(), It.IsAny <int>())).Returns(new List <EmployeeEntity>() { new EmployeeEntity("Petya", "06/05/2017") }); employees.Provider = new E3SLinqProvider(_mock.Object); foreach (var emp in employees.Where(e => e.workstation.EndsWith("IZHW0060"))) { Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate); } }
public void ReversePredicate() { var _mock = new Mock <E3SQueryClient>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); _mock.Setup(x => x.SearchFTS(It.IsAny <Type>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>())).Returns(new List <EmployeeEntity>() { new EmployeeEntity("Yana", "05/05/2017") }); employees.Provider = new E3SLinqProvider(_mock.Object); foreach (var emp in employees.Where(e => "EPRUIZHW0249" == e.workstation)) { Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate); } }
public void WithProvider() { var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); //foreach (var emp in employees.Where(e => e.workStation == "EPRUIZHW0249")) //{ // Console.WriteLine("{0} {1}", emp.nativeName, emp.shortStartWorkDate); //} //foreach (var emp in employees.Where(e => "EPRUIZHW0249" == e.workStation)) //{ // Console.WriteLine("{0} {1}", emp.nativeName, emp.shortStartWorkDate); //} foreach (var emp in employees.Where(e => e.workStation.StartsWith("EPRU") && e.lastName.Contains("ty"))) { Console.WriteLine("{0} {1}", emp.nativeName, emp.shortStartWorkDate); } }
public void WithProvider() { int count = 0; var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); Console.WriteLine("Part 1"); //<имя фильтруемого поля> == <константа> foreach (var emp in employees.Where(e => e.workstation == "EPRUIZHW0249")) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); } //PART 1 ********************************************************************************************* //<константа> == <имя фильтруемого поля> foreach (var emp in employees.Where(e => "EPRUIZHW0249" == e.workstation)) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); } Console.WriteLine("**************************"); //PART 2 ********************************************************************************************************** Console.WriteLine("Part 2"); //StartsWith foreach (var emp in employees.Where(e => e.workstation.StartsWith("EPRUIZHW024"))) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); count++; } Console.WriteLine("**************************"); Console.WriteLine($"StartsWith count = {count}"); Console.WriteLine("**************************"); count = 0; //EndsWith foreach (var emp in employees.Where(e => e.workstation.EndsWith("IZHW0249"))) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); count++; } Console.WriteLine("**************************"); Console.WriteLine($"EndsWith count = {count}"); Console.WriteLine("**************************"); count = 0; //Contains foreach (var emp in employees.Where(e => e.workstation.Contains("IZHW024"))) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); count++; } Console.WriteLine("**************************"); Console.WriteLine($"Contains count = {count}"); Console.WriteLine("**************************"); //PART 3********************************************************************************** //AND Console.WriteLine("Part 3"); count = 0; foreach (var emp in employees.Where(e => e.workstation == "EPRUIZHW0249" & e.citySum == "Izhevsk")) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); count++; } Console.WriteLine("**************************"); Console.WriteLine($"AND count = {count}"); Console.WriteLine("**************************"); count = 0; foreach (var emp in employees.Where(e => e.workstation == "EPRUIZHW0249" & e.citySum == "Minsk")) { Console.WriteLine($"{emp.nativename}, {emp.shortStartWorkDate}, {emp.citySum}, {emp.workstation}"); count++; } Console.WriteLine("**************************"); Console.WriteLine($"AND Wrong city!!! count = {count}"); }
public void Initialize() { employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); }