public void Constructor_PassNullRawData_ThrowNullReferenceException()
        {
            // Arrange
            List<Int16> data = null;
            ArcSecondResolution resolution = ArcSecondResolution.One;
            int rowLength = ElevationDataConstants.OneArcSecondResolutionRowLength;

            // Act
            _sut = new ElevationDataSet("", data, resolution, new DecimalGeoCoordinate(1,1), rowLength);
        }
        public void Constructor_PassZeroRowLength_ThrowInvalidOperationException()
        {
            // Arrange
            List<Int16> data = new List<Int16>();
            ArcSecondResolution resolution = ArcSecondResolution.One;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate();
            int rowLength = 0;

            // Act
            _sut = new ElevationDataSet("", data, resolution, coordinate, rowLength);
        }
        public void Constructor_PassValidParameters_PropertiesAreCorrectlyAssigned()
        {
            // Arrange
            List<Int16> data = new List<Int16>();
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate();
            int rowLength = ElevationDataConstants.ThreeArcSecondResolutionRowLength;

            // Act
            _sut = new ElevationDataSet("", data, resolution, coordinate, rowLength);

            // Assert
            Assert.AreEqual(_sut.Resolution, resolution);
            Assert.IsTrue(_sut.Location.Equals(coordinate));
        }
        public void DoesContainCoordinate_LatAndLongAreInsideDataSetCoverage_ReturnsTrue()
        {
            // Arrange
            List<Int16> data = new List<Int16>();
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);

            DecimalGeoCoordinate targetLocation = new DecimalGeoCoordinate(5.99, 5.01);

            _sut = new ElevationDataSet("", data, resolution, coordinate, 1);

            // Act
            bool isContainedInDataSet = _sut.DoesContainCoordinate(targetLocation);

            // Assert
            Assert.IsTrue(isContainedInDataSet);
        }
        public void DoesContainCoordinate_LatitudeIsGreaterThanDataSetCoverage_ReturnsFalse()
        {
            // Arrange
            List<Int16> data = new List<Int16>();
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);

            DecimalGeoCoordinate targetLocation = new DecimalGeoCoordinate(6.01, 5.5);

            _sut = new ElevationDataSet("", data, resolution, coordinate, 1);

            // Act
            bool isContainedInDataSet = _sut.DoesContainCoordinate(targetLocation);

            // Assert
            Assert.IsFalse(isContainedInDataSet);
        }
        public void GetGeoCoordinateForIndex_ValidIndex_ReturnsExpectedGeoCoordinate()
        {
            // Arrange
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);
            int rowLength = ElevationDataConstants.ThreeArcSecondResolutionRowLength;

            _sut = new ElevationDataSet("", _testElevationData, resolution, coordinate, rowLength);

            // Act
            DecimalGeoCoordinate geoCoord = _sut.GetGeoCoordinateForIndex(_testElevationData.Count / 2);

            // Assert
            Assert.IsTrue(geoCoord.Latitude == 5.5);
            Assert.IsTrue(geoCoord.Longitude == 5.5);
        }
        public void GetGeoCoordinateForIndex_NegativeIndex_ThrowIndexOutOfRangeException()
        {
            // Arrange
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);
            int rowLength = ElevationDataConstants.ThreeArcSecondResolutionRowLength;

            DecimalGeoCoordinate targetLocation = new DecimalGeoCoordinate(6.01, 5.5);

            _sut = new ElevationDataSet("", _testElevationData, resolution, coordinate, rowLength);

            // Act
            _sut.GetGeoCoordinateForIndex(-1);
        }
        public void GetElevationAtGeoCoordinate_PassTargetLocationOutsideDataSet_ThrowArgumentOutOfRangeException()
        {
            // Arrange
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);
            int rowLength = ElevationDataConstants.ThreeArcSecondResolutionRowLength;

            DecimalGeoCoordinate targetLocation = new DecimalGeoCoordinate(6.01, 5.5);

            _sut = new ElevationDataSet("", _testElevationData, resolution, coordinate, rowLength);

            // Act
            int elevation = _sut.GetElevationAtCoordinate(targetLocation);

            // Assert
        }
        public void GetElevationAtCoordinate_PassValidGeoCoordinate_ReturnsExpectedElevation()
        {
            // Arrange
            int rowLength = 100;
            List<Int16> data = CreateTestData(rowLength);
            ArcSecondResolution resolution = ArcSecondResolution.Three;
            DecimalGeoCoordinate coordinate = new DecimalGeoCoordinate(5, 5);

            DecimalGeoCoordinate targetLocation = new DecimalGeoCoordinate(5.5, 5.5);

            _sut = new ElevationDataSet("", data, resolution, coordinate, rowLength);

            // Act
            int elevation = _sut.GetElevationAtCoordinate(targetLocation);

            // Assert
            Assert.AreEqual(elevation, 99);
        }