コード例 #1
0
        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.startworkdate);
            }
        }
コード例 #2
0
        public void AndTest()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workStation.Contains("IZHW02") && e.nativeName == "Михаил Романов"))
            {
                Console.WriteLine($"{emp.nativeName} {emp.workStation}");
            }
        }
コード例 #3
0
        public void WithProviderConstantAndFilteredName()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => "EPRUIZHW0249" == e.workStation))
            {
                Console.WriteLine("{0} {1}", emp.nativeName, emp.shortStartWorkDate);
            }
        }
コード例 #4
0
        public void EndWithTest()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workStation.EndsWith("W0249")))
            {
                Console.WriteLine($"{emp.nativeName} {emp.workStation}");
            }
        }
コード例 #5
0
        public void AndMethodTask3()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workstation.StartsWith("EPRUIZHW0") && e.primaryTitle.EndsWith("Specialist") && e.primaryTitle.Contains("Dev")))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate);
            }
        }
コード例 #6
0
        //[TestMethod]
        public void StartsEndsOperationsTask2()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workstation.Contains("PRUIZHW024")))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate);
            }
        }
コード例 #7
0
        public void EndsWithTest()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workstation.EndsWith("0249")))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.workstation);
            }
        }
コード例 #8
0
        public void ConstantFirstTest()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => ("EPRUIZHW0249*") == e.workstation))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.workstation);
            }
        }
コード例 #9
0
        public void AndAlsoAndStartsWithAndContainsTest()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e => e.workstation.StartsWith("EPRUIZHW") && e.nativename.Contains("Михаил")))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.workstation);
            }
        }
コード例 #10
0
        public void Contains_Test()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);
            var empList   = employees.Where(e => e.workstation.Contains("IZHW030")).ToList();

            foreach (var emp in empList)
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.shortStartWorkDate);
            }
        }
コード例 #11
0
        public void WithProvider_And()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);

            foreach (var emp in employees.Where(e =>
                                                e.firstname == "Mihail" && e.room.Contains("4 Floor")))
            {
                Console.WriteLine("{0} {1}", emp.nativename, emp.room);
            }
        }
コード例 #12
0
        public void WhereContainsTest_AssertParameter()
        {
            var employees = new E3SEntitySet <EmployeeEntity>(_fakeClient);

            foreach (var emp in employees.Where(e => e.workstation.Contains("EPRUIZHW0249")))
            {
                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:(*EPRUIZHW0249*)""}]%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();
        }
コード例 #13
0
        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);
            }
        }
コード例 #14
0
        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);
            }
        }
コード例 #15
0
ファイル: E3SProviderTests.cs プロジェクト: Wiks00/D2.Task2
        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);
            }
        }
コード例 #16
0
        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}");
        }