Beispiel #1
0
        public void Search()
        {
            Console.WriteLine(@"Welcome to Zendesk search engine
Press Ctrl+C to exit at any time, Press enter to continue

Select Search options: 
     * Press 1 to search Zendesk
     * Press 2 to view a list of searchable fields
     * Press Ctrl+C to exit");

            var userInputSelectSearch = Console.ReadLine();

            if (userInputSelectSearch == "1")
            {
                Console.WriteLine(@"Select 1) Users 2) Tickets 3) Organisations");
                var userSearchInput    = Console.ReadLine();
                var termAndValueResult = SearchTermAndValue();

                switch (userSearchInput)
                {
                case "1":
                    Console.WriteLine($"Searching users for Key: {termAndValueResult.term} and Value: {termAndValueResult.val}");
                    var userSearchResult = _user.GetUserDetails(termAndValueResult.term, termAndValueResult.val);
                    UserFormatter.UserFormatOutput(userSearchResult);
                    break;

                case "2":
                    Console.WriteLine($"Searching tickets for Key: {termAndValueResult.term} and Value: {termAndValueResult.val}");
                    var ticketSearchResult = _ticket.GetTicketDetails(termAndValueResult.term, termAndValueResult.val);
                    TicketFormatter.FormatTicketOutput(ticketSearchResult);
                    break;

                case "3":
                    Console.WriteLine($"Searching organisations for Key: {termAndValueResult.term} and Value: {termAndValueResult.val}");
                    var orgSearchResult = _org.GetOrganizationDetails(termAndValueResult.term, termAndValueResult.val);
                    OranizationFormatter.FormatOrganizationOutput(orgSearchResult);
                    break;

                default:
                    Console.WriteLine("Invalid search option");
                    break;
                }
            }
            else if (userInputSelectSearch == "2")
            {
                GetAllSearchTerms.SearchTerms();
            }
            else
            {
                Console.WriteLine("No results found. Please check for valid inputs");
            }
        }
Beispiel #2
0
        public void GetUser_RequestKeyValue_ReturnsUserDetailsForUserWithRightKeyValue(string key, string val, string orgId)
        {
            var serialisedexpectedResponse = ExpectedResult();

            var expectedOrgResponse = ExpectedOrganization(orgId);

            _mockGetOrg.Setup(x => x.GetOrganizationDetails("Id", orgId)).Returns(expectedOrgResponse);

            var actualResponse           = _service.GetUserDetails(key, val);
            var serializedActualResponse = JsonConvert.SerializeObject(actualResponse);

            Assert.Equal(serialisedexpectedResponse, serializedActualResponse);
        }