Example #1
0
        public void GetPersonalHistoryByIdCardTest()
        {
            LicenseService target = new LicenseService();      // TODO: Initialize to an appropriate value
            string         idCard = "1980000000001";           // TODO: Initialize to an appropriate value
            ResponseService <PersonalHistory> expected = null; // TODO: Initialize to an appropriate value
            ResponseService <PersonalHistory> actual;

            actual = target.GetPersonalHistoryByIdCard(idCard);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        // GET: User/Delete/5
        public ActionResult Delete(int id)
        {
            ResponseService response = serviceClient.DeleteUser(id);

            if (response.Code == 0)
            {
                return(RedirectToAction("Index", "User"));
            }

            return(View());
        }
Example #3
0
        public void UpdateAttachFileTest()
        {
            IRegistrationService    target = CreateIRegistrationService(); // TODO: Initialize to an appropriate value
            RegistrationAttatchFile entity = null;                         // TODO: Initialize to an appropriate value
            ResponseService <RegistrationAttatchFile> expected = null;     // TODO: Initialize to an appropriate value
            ResponseService <RegistrationAttatchFile> actual;

            actual = target.UpdateAttachFile(entity);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void ReturnsBothActiveAndInactive()
        {
            // Arrange
            var service = new ResponseService(_responseRepositoryMock);

            // Act
            var responses = service.GetResponses(onlyActive: false);

            // Assert
            Assert.IsTrue(responses.Any(r => !r.IsActive));
        }
        public void GetAcceptOffNameByIdTest()
        {
            DataCenterService        target        = new DataCenterService(); // TODO: Initialize to an appropriate value
            string                   acceptOffCode = "111";                   // TODO: Initialize to an appropriate value
            ResponseService <string> expected      = null;                    // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.GetAcceptOffNameById(acceptOffCode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void GetTitleNameFromSexTest()
        {
            DataCenterService target = new DataCenterService();  // TODO: Initialize to an appropriate value
            string            sex    = "M";                      // TODO: Initialize to an appropriate value
            ResponseService <List <TitleName> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <TitleName> > actual;

            actual = target.GetTitleNameFromSex(sex);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #7
0
        public void UpdateSubjectTest()
        {
            IExamService             target   = CreateIExamService(); // TODO: Initialize to an appropriate value
            Subjectr                 subject  = null;                 // TODO: Initialize to an appropriate value
            ResponseService <string> expected = null;                 // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.UpdateSubject(subject);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #8
0
        private static Task <TResponse> Errors(IEnumerable <ValidationFailure> failures)
        {
            var response = new ResponseService();

            foreach (var failure in failures)
            {
                response.AddError(failure.ErrorMessage);
            }

            return(Task.FromResult(response as TResponse));
        }
Example #9
0
        public void GetSubjectrListTest()
        {
            IExamService target      = CreateIExamService();    // TODO: Initialize to an appropriate value
            string       licensecode = string.Empty;            // TODO: Initialize to an appropriate value
            ResponseService <List <Subjectr> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <Subjectr> > actual;

            actual = target.GetSubjectrList(licensecode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #10
0
        public void AddHolidayTest()
        {
            IExamService             target   = CreateIExamService(); // TODO: Initialize to an appropriate value
            GBHoliday                holiday  = null;                 // TODO: Initialize to an appropriate value
            ResponseService <string> expected = null;                 // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.AddHoliday(holiday);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #11
0
        public void GetHolidayTest()
        {
            IExamService target = CreateIExamService();  // TODO: Initialize to an appropriate value
            string       date   = string.Empty;          // TODO: Initialize to an appropriate value
            ResponseService <GBHoliday> expected = null; // TODO: Initialize to an appropriate value
            ResponseService <GBHoliday> actual;

            actual = target.GetHoliday(date);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #12
0
        public void GetExamByYearMonthTest()
        {
            IExamService target    = CreateIExamService();      // TODO: Initialize to an appropriate value
            string       yearMonth = string.Empty;              // TODO: Initialize to an appropriate value
            ResponseService <List <DateTime> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <DateTime> > actual;

            actual = target.GetExamByYearMonth(yearMonth);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #13
0
        public void GetExamByTestingNoTest()
        {
            IExamService target    = CreateIExamService();  // TODO: Initialize to an appropriate value
            string       testingNo = string.Empty;          // TODO: Initialize to an appropriate value
            ResponseService <ExamSchedule> expected = null; // TODO: Initialize to an appropriate value
            ResponseService <ExamSchedule> actual;

            actual = target.GetExamByTestingNo(testingNo);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #14
0
        public void GetApplicantByIdTest()
        {
            ApplicantService          target        = new ApplicantService(); // TODO: Initialize to an appropriate value
            string                    applicantCode = "1";                    // TODO: Initialize to an appropriate value
            string                    testingNo     = "579906";               // TODO: Initialize to an appropriate value
            string                    examPlaceCode = "10111";                // TODO: Initialize to an appropriate value
            ResponseService <DataSet> expected      = null;                   // TODO: Initialize to an appropriate value
            ResponseService <DataSet> actual;

            actual = target.GetApplicantById(applicantCode, testingNo, examPlaceCode);
        }
Example #15
0
        public void GetPersonalDetailByIDCard()
        {
            IRegistrationService target = CreateIRegistrationService(); // TODO: Initialize to an appropriate value
            string idCard = "2711000016188";                            // TODO: Initialize to an appropriate value
            ResponseService <DTO.Person> expected = null;               // TODO: Initialize to an appropriate value
            ResponseService <DTO.Person> actual;

            actual = target.GetPersonalDetailByIDCard(idCard);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void GetResponseById()
        {
            // Arrange
            var service = new ResponseService(_responseRepositoryMock);

            // Act
            var response = service.GetResponseById("1");

            // Assert
            Assert.AreEqual("Initial Application", response.Display);
        }
Example #17
0
        public void GetAgentTypeTest()
        {
            IRegistrationService target = CreateIRegistrationService(); // TODO: Initialize to an appropriate value
            string agentType            = string.Empty;                 // TODO: Initialize to an appropriate value
            ResponseService <List <AgentTypeEntity> > expected = null;  // TODO: Initialize to an appropriate value
            ResponseService <List <AgentTypeEntity> > actual;

            actual = target.GetAgentType(agentType);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #18
0
        public void GetByIdTest()
        {
            IApplicantService target = CreateIApplicantService(); // TODO: Initialize to an appropriate value
            string            Id     = string.Empty;              // TODO: Initialize to an appropriate value
            ResponseService <DTO.Applicant> expected = null;      // TODO: Initialize to an appropriate value
            ResponseService <DTO.Applicant> actual;

            actual = target.GetById(Id);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #19
0
        public void GetAttatchFilesByRegisterationNoTest()
        {
            IRegistrationService target = CreateIRegistrationService();         // TODO: Initialize to an appropriate value
            string registerationNo      = string.Empty;                         // TODO: Initialize to an appropriate value
            ResponseService <IList <RegistrationAttatchFile> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <IList <RegistrationAttatchFile> > actual;

            actual = target.GetAttatchFilesByRegisterationNo(registerationNo);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #20
0
        public void GetCompanyNameByIdToTextTest()
        {
            DataCenterService        target   = new DataCenterService(); // TODO: Initialize to an appropriate value
            string                   compCode = string.Empty;            // TODO: Initialize to an appropriate value
            ResponseService <string> expected = null;                    // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.GetCompanyNameByIdToText(compCode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #21
0
        public void DeleteTest()
        {
            IRegistrationService target = CreateIRegistrationService(); // TODO: Initialize to an appropriate value
            string Id = string.Empty;                                   // TODO: Initialize to an appropriate value
            ResponseService <DTO.Registration> expected = null;         // TODO: Initialize to an appropriate value
            ResponseService <DTO.Registration> actual;

            actual = target.Delete(Id);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void FiltersOnlyActive()
        {
            // Arrange
            var service = new ResponseService(_responseRepositoryMock);

            // Act
            var responses = service.GetResponses();

            // Assert
            Assert.IsFalse(responses.Any(r => !r.IsActive));
        }
        public void FiltersByQuestionKey()
        {
            // Arrange
            var service = new ResponseService(_responseRepositoryMock);

            // Act
            var responses = service.GetResponses("EmployerStatus");

            // Assert
            Assert.IsFalse(responses.Any(r => r.QuestionKey != "EmployerStatus"));
        }
Example #24
0
        public void GetApplicantGroupUploadByGroupUploadNoTest()
        {
            IApplicantService target        = CreateIApplicantService();                   // TODO: Initialize to an appropriate value
            string            groupUploadNo = string.Empty;                                // TODO: Initialize to an appropriate value
            ResponseService <UploadResult <UploadHeader, ApplicantTemp> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <UploadResult <UploadHeader, ApplicantTemp> > actual;

            actual = target.GetApplicantGroupUploadByGroupUploadNo(groupUploadNo);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #25
0
        public void GetSpecialDocTypeTest()
        {
            DataCenterService target      = new DataCenterService();   // TODO: Initialize to an appropriate value
            string            docStatus   = "A";                       // TODO: Initialize to an appropriate value
            string            trainStatus = "Y";                       // TODO: Initialize to an appropriate value
            ResponseService <List <SpecialDocument> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <SpecialDocument> > actual;

            actual = target.GetSpecialDocType(docStatus, trainStatus);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #26
0
        public void GetUserProfileByUsernameTest()
        {
            IPersonService            target   = CreateIPersonService(); // TODO: Initialize to an appropriate value
            string                    userName = string.Empty;           // TODO: Initialize to an appropriate value
            string                    email    = string.Empty;           // TODO: Initialize to an appropriate value
            ResponseService <DataSet> expected = null;                   // TODO: Initialize to an appropriate value
            ResponseService <DataSet> actual;

            actual = target.GetUserProfileByUsername(userName, email);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #27
0
        public void GetDataTo8ReportTest()
        {
            IPersonService            target       = CreateIPersonService(); // TODO: Initialize to an appropriate value
            string                    ID           = string.Empty;           // TODO: Initialize to an appropriate value
            string                    license_code = string.Empty;           // TODO: Initialize to an appropriate value
            ResponseService <DataSet> expected     = null;                   // TODO: Initialize to an appropriate value
            ResponseService <DataSet> actual;

            actual = target.GetDataTo8Report(ID, license_code);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #28
0
        public void GetUserProfileTest()
        {
            IPersonService target  = CreateIPersonService(); // TODO: Initialize to an appropriate value
            string         Id      = string.Empty;           // TODO: Initialize to an appropriate value
            string         memType = string.Empty;           // TODO: Initialize to an appropriate value
            ResponseService <DTO.Person> expected = null;    // TODO: Initialize to an appropriate value
            ResponseService <DTO.Person> actual;

            actual = target.GetUserProfile(Id, memType);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #29
0
        public void GetLicenseConfigByPetitionTest()
        {
            LicenseService target       = new LicenseService();       // TODO: Initialize to an appropriate value
            string         petitionType = "11";                       // TODO: Initialize to an appropriate value
            string         licenseType  = "03";                       // TODO: Initialize to an appropriate value
            ResponseService <List <ConfigDocument> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <ConfigDocument> > actual;

            actual = target.GetLicenseConfigByPetition(petitionType, licenseType);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #30
0
        public void GetExamHistoryByIDWithConditionTest()
        {
            LicenseService target          = new LicenseService();                                        // TODO: Initialize to an appropriate value
            string         idCard          = "3100900224766";                                             // TODO: Initialize to an appropriate value
            string         licenseTypeCode = "04";                                                        // TODO: Initialize to an appropriate value
            ResponseService <List <ExamHistory> > expected = new ResponseService <List <ExamHistory> >(); // TODO: Initialize to an appropriate value
            ResponseService <List <ExamHistory> > actual;

            actual = target.GetExamHistoryByIDWithCondition(idCard, licenseTypeCode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        private string AnalyzeMessage(string[] messageParts)
        {
            if (messageParts.Contains("what") && messageParts.Contains("time"))
                return DateTime.Now.ToLongTimeString();

            if (messageParts.Contains("weather"))
            {
                string city = "Minsk";
                if (messageParts.Contains("in"))
                {
                    int index = Array.IndexOf(messageParts, "in");
                    if (index++ < messageParts.Length)
                        city = messageParts[index];
                }

                OpenWeatherMap owm = new OpenWeatherMap();
                var weatherResponse = owm.GetWeatherByCity(city);

                //this is a message builder, trust me
                var message = "In " + weatherResponse.City + " " + weatherResponse.Description + " and the temperature is " + weatherResponse.Tempearature + "°C";

                return message;
            }

            if (messageParts.Contains("what") && messageParts.Contains("is") || messageParts.Contains("are"))
            {
                var doc = new XmlDocument();

                int index = Array.IndexOf(messageParts, "is") != -1 ? Array.IndexOf(messageParts, "is") : Array.IndexOf(messageParts, "are");
                if (index == -1)
                    return "What?";
                    
                string query = string.Empty;
                for (int i = index + 1; i < messageParts.Length; i++)
                {
                    query += messageParts[i] + " ";
                }

                var url = string.Format(@"https://en.wikipedia.org/w/api.php?action=opensearch&search={0}&format=xml", query);
                var response = new ResponseService().GetResponse(url);

                StringReader sr = new StringReader(response);
                XmlSerializer s = new XmlSerializer(typeof(SearchSuggestion), @"http://opensearch.org/searchsuggest2");
                var res = (SearchSuggestion)s.Deserialize(sr);

                var message = res.Query.Text + " - " + res.Section.Item.First().Description.Text;

                return message;
            }

            return "What?";
        }
        public void Execute(Api bot, string[] currencies, Update update)
        {
            string url = string.Format(@"https://query.yahooapis.com/v1/public/yql?q=env 'store://datatables.org/alltableswithkeys'; select * from yahoo.finance.xchange where pair='{0}'&format=json", currencies[1] + currencies[2]);

            string responseString = new ResponseService().GetResponse(url);

            Console.WriteLine(responseString);

            var rateResponse = JsonConvert.DeserializeObject<RateResponse>(responseString);

            var message = "1 " + currencies[1] + " = " + rateResponse.query.results.rate.Rate + currencies[2];

            var t = bot.SendTextMessage(update.Message.Chat.Id, message);
            Console.WriteLine("Echo Message: {0}", message);
        }
        public Models.Weather GetWeatherByCity(string city)
        {
            WebUtility.UrlEncode(city);
            string url = string.Format("http://api.openweathermap.org/data/2.5/weather?q={0}&APPID={1}&units=metric", city, weatherApiKey);

            string responseString = new ResponseService().GetResponse(url);
            
            Console.WriteLine(responseString);

            var weatherResponse = JsonConvert.DeserializeObject<WeatherResponse>(responseString);

            return new Models.Weather()
            {
                City = weatherResponse.name,
                Description = weatherResponse.weather.First().description,
                Tempearature = weatherResponse.main.temp
            };
        }
        public Models.Weather GetWeatherByCity(string city)
        {
            WebUtility.UrlEncode(city);
            string url = string.Format(@"https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='{0}') and u='c'&format=json", city);

            string responseString = new ResponseService().GetResponse(url);
            
            Console.WriteLine(responseString);

            var weatherResponse = JsonConvert.DeserializeObject<WeatherResponse>(responseString);

            return new Models.Weather()
            {
                City = weatherResponse.query.results.channel.location.city,
                Description = weatherResponse.query.results.channel.item.condition.text,
                Tempearature = Convert.ToDouble(weatherResponse.query.results.channel.item.condition.temp)
            };
        }