Пример #1
0
        public void Should_get_multiple_weathers()
        {
            var weatherServiceMock = Mock.Create <IWeatherService>();

            Mock.Arrange(() => weatherServiceMock.GetWeatherForZip("12345"))
            .Returns(() => new Weather {
                ZipCode = "12345", TemperaturInFahrenheit = 68, WindSpeed = 8
            });

            Mock.Arrange(() => weatherServiceMock.GetWeatherForZip("04103"))
            .Returns(() => new Weather {
                ZipCode = "04103", TemperaturInFahrenheit = 68, WindSpeed = 8
            });

            var vm = new ViewWeatherVM(weatherServiceMock);

            var weathers = vm.GetWeathers(new string[] { "12345", "04103" });

            Assert.AreEqual(2, weathers.Count);
            Assert.AreEqual("12345", weathers[0].ZipCode);
            Assert.AreEqual(68, weathers[0].TemperaturInFahrenheit);
            Assert.AreEqual(8, weathers[0].WindSpeed);

            Assert.AreEqual("04103", weathers[1].ZipCode);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var input = Console.ReadLine();

            var zipCodes = input.Split(' ');

            var weatherVM = new ViewWeatherVM();
            var weathers  = weatherVM.GetWeathers(zipCodes);

            WriteWeathers(weathers);
        }