public void GetEmployee_Should_Return_Cached_Data_And_New_Additions()
        {
            var             _cacheInstance = MemoryCaching.Instance;
            BasicHttpClient _httpClient    = new BasicHttpClient(CreateFakeResponseHandler());

            _cacheInstance._cacheObject.Set("g2Roster", Cache_MockData(), new CacheItemPolicy());
            var _g2CrowdDataService = new G2CrowdDataService(_cacheInstance, _httpClient);
            var response            = _g2CrowdDataService.GetEmployeeData();

            Assert.AreEqual(response.G2CrowdRoster.Count, 3);
        }
        public void GetEmployee_Should_Return_Cached_Data_With_Right_NumberOfVotes()
        {
            var             _cacheInstance = MemoryCaching.Instance;
            BasicHttpClient _httpClient    = new BasicHttpClient(CreateFakeResponseHandler());

            _cacheInstance._cacheObject.Set("g2Roster", Cache_MockData(), new CacheItemPolicy());
            var _g2CrowdDataService = new G2CrowdDataService(_cacheInstance, _httpClient);
            var response            = _g2CrowdDataService.GetEmployeeData();

            Assert.AreEqual(response.G2CrowdRoster[0].Number_Of_Votes, 5);
            Assert.AreEqual(response.G2CrowdRoster[1].Number_Of_Votes, 4);
        }
        public void UpdateVotingInfo_Should_Return_Cached_Data_With_Updated_Votes()
        {
            var             _cacheInstance = MemoryCaching.Instance;
            BasicHttpClient _httpClient    = new BasicHttpClient(CreateFakeResponseHandler());

            _cacheInstance._cacheObject.Set("g2Roster", Cache_MockData(), new CacheItemPolicy());
            var _g2CrowdDataService = new G2CrowdDataService(_cacheInstance, _httpClient);
            var personalData        = new G2CrowdPersonalData {
                Name            = "Michael Wheeler",
                Title           = "CTO / Co-founder",
                Image_Url       = "https://d2eyrv63e6x6lp.cloudfront.net/wp-content/uploads/2015/02/20141833/Mike-Wheeler.jpg",
                Bio             = "Mike has been programming since his dad bought him an Apple II when he was 12, and he is as passionate about the craft of programming as he is about building and supporting a quality business. He came to G2Crowd from TapJoy, where he helped to launch a mobile webproduct to an audience of more than 3 million users. Mike also spent four years on the BigMachines team, harnessing the latest web standards to design, build, and launch innovative web applications. When he isn’t applying technological know-how to business problems, Mike can usually be found dancing lindy hop at one of Chicago’s many jazz clubs, or training at a Capoeira academy.",
                Number_Of_Votes = 5
            };

            _g2CrowdDataService.UpdateVotingInfo(personalData, Update_Info_Data());
            var result = (G2RosterModel)_cacheInstance._cacheObject.Get("g2Roster");

            Assert.AreEqual(result.G2CrowdRoster[0].Number_Of_Votes, 6);
        }
Exemplo n.º 4
0
 public HomeController()
 {
     _g2CrowdDataService = new G2CrowdDataService(_cache, _httpClient);
 }