Exemplo n.º 1
0
        public void CanGetCities_CitiesService()
        {
            using (var context = new TicketsResellingContext(ContextOptions))
            {
                var citiesService = new CitiesService(context);

                var cities = citiesService.GetCities().Result.ToList();

                cities.Count().Should().Be(3);
                cities[0].Name.Should().Be("Tallin");
            }
        }
Exemplo n.º 2
0
        public void CanAddCity_CitiesService()
        {
            using (var context = new TicketsResellingContext(ContextOptions))
            {
                var citiesService = new CitiesService(context);

                var city = new City {
                    Name = "Berlin", Status = CityStatuses.Avaliable
                };
                citiesService.AddCity(city);
                var cities = citiesService.GetCities().Result.ToList();

                cities.Count().Should().Be(4);
                cities[3].Name.Should().Be("Berlin");
            }
        }
Exemplo n.º 3
0
        public void GetCitiesTest()
        {
            var mockRepository = new Mock <IDeletableEntityRepository <City> >();

            mockRepository.Setup(x => x.All()).Returns(this.GetCityData());

            var service = new CitiesService(mockRepository.Object);

            var cityNames = service.GetCities();

            var result = new List <string> {
                "Sofia", "Plovdiv", "Tokyo"
            }.OrderBy(n => n);

            Assert.Equal(result, cityNames);
        }
Exemplo n.º 4
0
 public ActionResult Index()
 {
     ViewBag.Cities = service.GetCities();
     ViewBag.Types  = service.GetTypes();
     return(View());
 }