Пример #1
0
        /// <summary>
        /// Private Methods Section
        /// </summary>

        ///Init method used to initialize subsystems to prevent having null objects
        private void InitSystems()
        {
            dailyMeteoSystem  = new DailyMeteoSystem();
            predictionManager = new PredictionManager();
            queryManager      = new QueryManager();
            dataRetreiver     = new DataRetreiver();
            resultHandler     = new ResultHandler();
            decisionMaker     = new DecisionMaker();
        }
Пример #2
0
        static void Main(string[] args)
        {
            const string     peopleEndPoint = "http://agl-developer-test.azurewebsites.net/people.json";
            IDataRetreiver   dataRetreiver  = new DataRetreiver();
            IServiceConsumer service        = new PeopleServiceConsumer(peopleEndPoint, dataRetreiver);
            var peopleList = service.GetAllPeople();

            IView view = new ConsoleView();

            view.DisplayGroupedAndSortedPeopleData(peopleList);
        }
        public void TestValidServiceUrlAsync()
        {
            string         url           = "http://agl-developer-test.azurewebsites.net/people.json";
            IDataRetreiver dataRetreiver = new DataRetreiver();
            var            actual        = Task.Run(async() => await dataRetreiver.GetData(url));

            actual.Wait();
            String expected = "[{\"name\":\"Bob\",\"gender\":\"Male\",\"age\":23,\"pets\":[{\"name\":\"Garfield\",\"type\":\"Cat\"},{\"name\":\"Fido\",\"type\":\"Dog\"}]},{\"name\":\"Jennifer\",\"gender\":\"Female\",\"age\":18,\"pets\":[{\"name\":\"Garfield\",\"type\":\"Cat\"}]},{\"name\":\"Steve\",\"gender\":\"Male\",\"age\":45,\"pets\":null},{\"name\":\"Fred\",\"gender\":\"Male\",\"age\":40,\"pets\":[{\"name\":\"Tom\",\"type\":\"Cat\"},{\"name\":\"Max\",\"type\":\"Cat\"},{\"name\":\"Sam\",\"type\":\"Dog\"},{\"name\":\"Jim\",\"type\":\"Cat\"}]},{\"name\":\"Samantha\",\"gender\":\"Female\",\"age\":40,\"pets\":[{\"name\":\"Tabby\",\"type\":\"Cat\"}]},{\"name\":\"Alice\",\"gender\":\"Female\",\"age\":64,\"pets\":[{\"name\":\"Simba\",\"type\":\"Cat\"},{\"name\":\"Nemo\",\"type\":\"Fish\"}]}]";

            Assert.AreEqual(expected, actual.Result);
        }
 public void TestNullDataRetreiver()
 {
     IDataRetreiver   dataRetreiver = new DataRetreiver();
     IServiceConsumer testService   = new PeopleServiceConsumer("invalid", null);
 }
 public void TestEmptyEndpointUrl()
 {
     IDataRetreiver   dataRetreiver = new DataRetreiver();
     IServiceConsumer testService   = new PeopleServiceConsumer(String.Empty, dataRetreiver);
 }