コード例 #1
0
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            string MDeg      = tbxDeg.Text;
            string MMin      = tbxMin.Text;
            string MSec      = tbxSec.Text;
            string MQuadrant = cboQuandrant.SelectedItem.ToString();
            int    deg;
            int    min;
            double sec;

            deg = int.Parse(MDeg);
            min = int.Parse(MMin);
            sec = double.Parse(MSec);



            DMSConverter dms = new DMSConverter();

            DMSCoord Coord = new DMSCoord();

            Coord.deg      = deg;
            Coord.min      = min;
            Coord.sec      = sec;
            Coord.quadrant = (Quadrant)Enum.Parse(typeof(Quadrant), MQuadrant);


            lbIDd.Text = dms.Dms2Dd(Coord).ToString();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //int deg = int.Parse(textBox1_TextChanged.Text);
            DMSCoord Coords = new DMSCoord();

            Coords.deg      = Convert.ToInt16(tbxDeg.Text);
            Coords.min      = Convert.ToInt16(tbxMin.Text);
            Coords.sec      = Convert.ToDouble(tbxSec.Text);
            Coords.quadrant = 0;
            DMSConverter target = new DMSConverter();

            DecDegoutput.Text = Convert.ToString(target.Dms2Dd(Coords));
        }
コード例 #3
0
        public void DMS2Dd_InvalidCoords_Calculated()
        {
            //Arrange
            DMSCoord Coords = new DMSCoord();

            Coords.deg      = -360;
            Coords.min      = 11456;
            Coords.sec      = 11.1;
            Coords.quadrant = 0;
            DMSConverter target   = new DMSConverter();
            double       expected = 9999;

            //Act
            string actual = Convert.ToString(target.Dms2Dd(Coords));

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void DMS2Dd_ValidCoords_Calculated()
        {
            //Arrange
            DMSCoord Coords = new DMSCoord();

            Coords.deg      = 50;
            Coords.min      = 11;
            Coords.sec      = 11.1;
            Coords.quadrant = 0;
            DMSConverter target   = new DMSConverter();
            string       expected = "50.18642";

            //Act
            string actual = Convert.ToString(target.Dms2Dd(Coords));

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void Dms2Dd_InvalidNcoord_Returns9999()
        {
            //Arrange
            DMSConverter dms      = new DMSConverter();
            double       expected = 9999;

            //Act
            DMSCoord coord = new DMSCoord
            {
                deg      = 56,
                min      = 30,
                sec      = 36,
                quadrant = Quadrant.N
            };
            double actual = dms.Dms2Dd(coord);

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void Dms2Dd_ValidNcoord_Calculated()
        {
            //Arrange
            DMSConverter dms      = new DMSConverter();
            double       expected = 56.51;

            //Act
            DMSCoord coord = new DMSCoord
            {
                deg      = 56,
                min      = 30,
                sec      = 36,
                quadrant = Quadrant.N
            };
            double actual = dms.Dms2Dd(coord);

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void DMS2Dd_ValidNcoord_Calculated()
        {
            //Arrange
            DMSConverter target   = new DMSConverter();
            double       expected = 45.425533;

            DMSCoord testCoord = new DMSCoord();

            testCoord.deg      = 45;
            testCoord.min      = 25;
            testCoord.sec      = 31.9188;
            testCoord.quadrant = Quadrant.N;

            //Act
            double actual = target.Dms2Dd(testCoord);

            //Assert
            Assert.AreEqual(expected, actual, 0);
        }
コード例 #8
0
        public void DMS2Dd_InvalidNcoord_Returns9999()
        {
            //Arrange
            DMSConverter target   = new DMSConverter();
            double       expected = 9999;

            DMSCoord testCoord = new DMSCoord();

            testCoord.deg      = 71;
            testCoord.min      = 61;
            testCoord.sec      = 200;
            testCoord.quadrant = Quadrant.N;

            //Act
            double actual = target.Dms2Dd(testCoord);

            //Assert
            Assert.AreEqual(expected, actual);
        }