public void CanGetAllAPIURLSInChart()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);

            Chart myChart = new Chart { ChartId = 1, OwnerId = owner.Id };
            City myCity = new City { CityId = 1, ApiURL = "Hello" };
            City myCity2 = new City { CityId = 2, ApiURL = "My Name" };
            City myCity3 = new City { CityId = 3, ApiURL = "Is Kate" };
            ChartItem newItem = new ChartItem { City = myCity, ChartId =1 };
            ChartItem newItem2 = new ChartItem { City = myCity2, ChartId = 1 };
            ChartItem newItem3 = new ChartItem { City = myCity3, ChartId = 1 };

            myCharts.Add(myChart);
            myCities.Add(myCity);
            myCities.Add(myCity2);
            myCities.Add(myCity3);
            myChartItems.Add(newItem);
            myChartItems.Add(newItem2);
            myChartItems.Add(newItem3);

            ConnectMocksToDataSource();

            //act
            List<string> ApiUrls = chartRepo.GetApiUrlsInChart(1);

            //assert
            Assert.AreEqual(ApiUrls.Count, 3);
            Assert.AreEqual(ApiUrls[1], "My Name");
            Assert.AreEqual(ApiUrls[2], "Is Kate");
        }
        public void CanCreateChart()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);
            ConnectMocksToDataSource();
            //act
            var result = chartRepo.AddChartToNewProfile(owner.Id);

            //assert
            Assert.AreEqual(result.GetType(), typeof(int));
        }
        public void CanAddChartItemToChart()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);

            Chart myChart = new Chart { ChartId = 1, OwnerId = owner.Id };
            City myCity = new City { CityId = 1 };
            ChartItem newItem = new ChartItem { City = myCity };
            ChartItem newItem2 = new ChartItem { City = myCity };

            myCharts.Add(myChart);

            ConnectMocksToDataSource();

            //act
            var result = chartRepo.AddChartItem(1, newItem);
            var result2 = chartRepo.AddChartItem(1, newItem2);

            //assert
            Assert.IsTrue(result && result2);
        }
        public void CanUpdateCityPriorityInChart()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);

            Chart myChart = new Chart { ChartId = 1, OwnerId = owner.Id };
            City myCity = new City { CityId = 1 };
            City myCity2 = new City { CityId = 2 };
            City myCity3 = new City { CityId = 3 };
            ChartItem newItem = new ChartItem { City = myCity };
            ChartItem newItem2 = new ChartItem { City = myCity2 };
            ChartItem newItem3 = new ChartItem { City = myCity3 };

            myCharts.Add(myChart);

            ConnectMocksToDataSource();

            var result = chartRepo.AddChartItem(1, newItem);
            var result2 = chartRepo.AddChartItem(1, newItem2);
            var result3 = chartRepo.AddChartItem(1, newItem3);

            //act
            var result4 = chartRepo.RearrangeChartItems(1, newItem2, 0);

            //assert
            Assert.IsTrue(result4);
            Assert.AreEqual(myChart.ChartItems[0].City.CityId, newItem2.City.CityId);
            Assert.AreEqual(myChart.ChartItems[1].City.CityId, newItem.City.CityId);
            Assert.AreEqual(myChart.ChartItems[2].City.CityId, newItem3.City.CityId);
        }
        public void CanGetCityById()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);
            City NewYork = new City { CityId = 1, CountryId = 1, Name = "NewYork" };
            City Tokyo = new City { CityId = 2, CountryId = 2, Name = "Tokyo" };

            myCities.Add(NewYork);
            myCities.Add(Tokyo);
            //act
            ConnectMocksToDataSource();
            City Actual = chartRepo.GetCityById(1);
            //assert
            Assert.AreEqual(Actual.CityId, 1);
            Assert.AreEqual(Actual.Name, "NewYork");
        }
        public void CanGetAllCountries()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);
            Country Usa = new Country { CountryId = 1, Name = "USA" };
            Country Mexico = new Country { CountryId = 2, Name = "Mexico" };

            myCountries.Add(Usa);
            myCountries.Add(Mexico);
            //act
            ConnectMocksToDataSource();
            List<Country> Actual = chartRepo.GetAllCountries();
            //assert
            Assert.AreEqual(Actual.Count(), 2);
        }