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");
        }
 //Add Chart to New Profile
 public int AddChartToNewProfile(string ownerId)
 {
     var chart = new Chart { OwnerId = ownerId, ChartItems = new List<ChartItem>() };
     context.Charts.Add(chart);
     context.SaveChanges();
     return chart.ChartId;
 }
        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);
        }