public void EnsureCanRemoveDataPoint() { //Arrange Image image_1 = new Image { ImageID = 1, URL = "www.thisthing.com" }; Image image_2 = new Image { ImageID = 2, URL = "www.thatthing.com" }; DataPoint datapoint_1 = new DataPoint { DataPointID = 24, Latitude = 1.234567, Longitude = 7.654321, Snapshot = image_1 }; DataPoint datapoint_2 = new DataPoint { DataPointID = 25, Latitude = 1.234567, Longitude = 7.654321, Snapshot = image_2 }; //Act Repo.AddDataPoint(datapoint_1); Repo.AddDataPoint(datapoint_2); Repo.RemoveDataPoint(24); int expected_count = 1; DataPoint found_datapoint = Repo.GetDataPointByID(25); int actual_count = Repo.GetAllDataPoints().Count(); //Assert Assert.IsNotNull(found_datapoint); Assert.AreEqual(expected_count, actual_count); }
public void EnsureCanGetAllDataPoints() { //Arrange Image image_1 = new Image { ImageID = 1, URL = "www.thisthing.com" }; Image image_2 = new Image { ImageID = 2, URL = "www.thatthing.com" }; DataPoint datapoint_1 = new DataPoint { DataPointID = 1, Latitude = 1.234567, Longitude = 7.654321, Snapshot = image_1 }; DataPoint datapoint_2 = new DataPoint { DataPointID = 2, Latitude = 7.654321, Longitude = 1.234567, Snapshot = image_2 }; //Act Repo.AddDataPoint(datapoint_1); Repo.AddDataPoint(datapoint_2); int expected_count = 2; int actual_count = Repo.GetAllDataPoints().Count(); //Assert Assert.AreEqual(expected_count, actual_count); }
public void EnsureCanAddNewDataPoint() { //Arrange DataPoint datapoint_1 = new DataPoint { DataPointID = 1, Latitude = 1.234567, Longitude = 7.654321 }; DataPoint datapoint_2 = new DataPoint { DataPointID = 2, Latitude = 7.654321, Longitude = 1.234567 }; //Act Repo.AddDataPoint(datapoint_1); Repo.AddDataPoint(datapoint_2); int expected_count = 2; int actual_count = Repo.Context.DataPoints.Count(); //Assert Assert.AreEqual(expected_count, actual_count); }
public void EnsureCanGetDataPointByID() { //Arrange DataPoint datapoint_1 = new DataPoint { DataPointID = 1, Latitude = 1.234567, Longitude = 7.654321 }; DataPoint datapoint_2 = new DataPoint { DataPointID = 2, Latitude = 7.654321, Longitude = 1.234567 }; //Act Repo.AddDataPoint(datapoint_1); Repo.AddDataPoint(datapoint_2); int expected_id = 1; DataPoint found_datapoint = Repo.GetDataPointByID(1); int actual_id = found_datapoint.DataPointID; //Assert Assert.IsNotNull(found_datapoint); Assert.AreEqual(expected_id, actual_id); }