コード例 #1
0
 public void SetUp()
 {
     _weatherDetails = MockWeatherDetailsFactory.CreateMockWeatherDetails();
 }
コード例 #2
0
 public void SetUp()
 {
     _weatherInfo = MockWeatherDetailsFactory.CreateMockWeatherDetails().Information;
 }
コード例 #3
0
        public void SetUp()
        {
            // Set up Mock Repository with defaults
            _mockCityRepository = new Mock <IReadonlyRepository <City> >();
            _mockCityRepository.Setup(repo => repo.Get(1)).Returns(new City {
                Code = 1, Name = "Cape Town"
            });

            // Set up Mock RestClient with defaults
            _mockRestClient = new Mock <IRestClient <WeatherDetails> >();
            _mockRestClient.Setup(client => client.Get(It.IsAny <Dictionary <string, object> >(), null)).Returns(Task.FromResult(MockWeatherDetailsFactory.CreateMockWeatherDetails()));

            // Set up Logger
            _mockLogger = new Mock <ILogger>();

            // Set up Mock Request Factory
            _mockRequestFactory = new Mock <IRequestFactory>();
            _mockRequestFactory.Setup(c => c.CreateRequest(It.IsAny <string>())).Returns(new WeatherRequest {
                City = "Cape Town"
            });
            _weatherDetailsBuilder = new WeatherDetailsBuilder(_mockLogger.Object, _mockRestClient.Object, _mockCityRepository.Object, _mockRequestFactory.Object);
        }