public void SetDirection_GetDirection() { double expectedDirection = 1.0; mockPortService.Setup(m => m.RPC("Write", 0, It.IsInRange(0, 256, Range.Inclusive))).Returns(() => "256"); mockPortService.Setup(m => m.RPC("Read", 0)).Returns(() => "256"); ICarControllerService carControllerService = new CarControllerService(mockPortService.Object, new CarControllerSettings()); carControllerService.SetDirection(expectedDirection); double direction = carControllerService.GetDirection(); Assert.AreEqual(expectedDirection, direction); }