Beispiel #1
0
        public void TestRecieveTrack_validData_ReturnsExpectedTime() //format test to match the way  TestRecieveTrack_IllegalTimeString_ThrowsFormatException is set up.
        {
            //Arrange
            var data = "tag;3.7;2000.5;5000;20171212200012250";

            string[] formats = { "yyyyMMddHHmmssfff" };
            var      time    = DateTime.ParseExact("20171212200012250", formats[0], CultureInfo.CurrentCulture);;

            //Act
            track = (Track)tf.RecieveTrack(data);

            Assert.That(track.Timestamp, Is.EqualTo(time));
        }
Beispiel #2
0
        public void TestRecieveTrack_LegalValue_ReturnsMatchingTrack() //naming is not specific enough yet
        {
            var data = "tag;3.7;2000.5;5000;20151006213456789";
            var time = DateTime.Now;

            var trackFormatter = new TrackFormatter();

            tagString, xPosFloat, yPosFloat, altitudeFloat, timestamp
            var returnVal = Substitute.For <Track>("tag", 3.7f, 2000.5f, 5000, time); //sets up our return value

            trackFormatter.RecieveTrack("").Returns(returnVal);

            Assert.That(trackFormatter.RecieveTrack(data), Is.EqualTo(returnVal)); //act and assert
        }