示例#1
0
 public void TestLoadSearchOporto()
 {
     using (WeatherWebApi api = new WeatherWebApi())
     {
         LocationInfo[] locals = api.Search("oporto");
         Assert.AreEqual(6, locals.Length);
         Assert.AreEqual("Cuba", locals[5].Country);
     }
 }
 public void ShouldLoadSearchOporto()
 {
     using (WeatherWebApi api = new WeatherWebApi())
     {
         IEnumerable <LocationInfo> locals = api.Search("oporto");
         Assert.AreEqual(6, locals.Count());
         Assert.AreEqual("Cuba", locals.ElementAt(5).Country);
     }
 }
示例#3
0
        public void TestLoadSearchOportoOnRequestMock()
        {
            Mocker mocker = new Mocker(typeof(IHttpRequest));

            mocker.When("GetBody")
            .With(oportoSearchUrl)
            .Return(oportoSearchBody);
            mocker
            .When("Dispose").Then(() => { }).With();

            IHttpRequest req = (IHttpRequest)mocker.Create();

            using (IWeatherWebApi api = new WeatherWebApi(req))
            {
                IEnumerable <LocationInfo> locals = api.Search("oporto");
                Assert.AreEqual(6, locals.Count());
                Assert.AreEqual("Cuba", locals.ElementAt(5).Country);
            }
        }