2010-12-22 02:42:16 -04:00
|
|
|
using ArducopterConfigurator.PresentationModels;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace ArducopterConfiguratorTest
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class AcroModeConfigVmTest : VmTestBase<AcroModeConfigVm>
|
|
|
|
{
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
sampleLineOfData = "1.950,0.100,0.200,1.950,0.300,0.400,3.200,0.500,0.600,0.320";
|
|
|
|
getCommand = "P";
|
|
|
|
setCommand = "O";
|
|
|
|
|
2010-12-23 11:59:00 -04:00
|
|
|
_mockComms = new MockComms();
|
2011-02-04 17:45:31 -04:00
|
|
|
_mockComms.Connect();
|
2010-12-23 11:59:00 -04:00
|
|
|
_vm = new AcroModeConfigVm(_mockComms);
|
2010-12-22 02:42:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void UpdateStringSentIsCorrect()
|
|
|
|
{
|
|
|
|
_vm.PitchP = 1.0F;
|
|
|
|
_vm.PitchI = 2.0F;
|
|
|
|
_vm.PitchD = 3.0F;
|
|
|
|
_vm.RollP = 5.0F;
|
|
|
|
_vm.RollI = 6.0F;
|
|
|
|
_vm.RollD = 7.0F;
|
|
|
|
_vm.YawP = 8.0F;
|
|
|
|
_vm.YawI = 9.0F;
|
|
|
|
_vm.YawD = 10.0F;
|
|
|
|
_vm.TransmitterFactor = 4.0F;
|
|
|
|
|
|
|
|
_vm.UpdateCommand.Execute(null);
|
|
|
|
|
2010-12-23 11:59:00 -04:00
|
|
|
Assert.AreEqual(1, _mockComms.SentItems.Count);
|
|
|
|
Assert.AreEqual("O5;6;7;1;2;3;8;9;10;4", _mockComms.SentItems[0]);
|
2010-12-22 02:42:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|