Have one last unit test
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Dynamic;
|
||||
|
||||
namespace Tello_Drone
|
||||
{
|
||||
public interface IUdpClientWrapperFactory
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
|
||||
namespace Tello_Drone
|
||||
{
|
||||
public class MissionCommander : IMissionCommander
|
||||
@@ -15,12 +11,13 @@ namespace Tello_Drone
|
||||
|
||||
public void RunMission(IMissions mission)
|
||||
{
|
||||
SetUpDrone(3);
|
||||
if(!SetUpDrone(3))
|
||||
return;
|
||||
mission.Run(_drone);
|
||||
TearDownDrone();
|
||||
}
|
||||
|
||||
private void SetUpDrone(int retryCount)
|
||||
private bool SetUpDrone(int retryCount)
|
||||
{
|
||||
var inCommandMode = false;
|
||||
while (inCommandMode != true && retryCount > 0)
|
||||
@@ -28,7 +25,11 @@ namespace Tello_Drone
|
||||
inCommandMode = _drone.Command();
|
||||
retryCount--;
|
||||
}
|
||||
|
||||
if (!inCommandMode)
|
||||
return false;
|
||||
_drone.TakeOff();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void TearDownDrone()
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FastExpressionCompiler.LightExpression;
|
||||
using ImTools;
|
||||
using Tello_Drone.Missions;
|
||||
|
||||
namespace Tello_Drone
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace Tello_Drone.Missions
|
||||
{
|
||||
[TestNameAttributes("Mission 2")]
|
||||
public class Mission2: IMissions
|
||||
{
|
||||
public void Run(Drone drone)
|
||||
{
|
||||
|
||||
drone.Forward(45);
|
||||
drone.BackFlip();
|
||||
drone.Reverse(45);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Tello_Drone.Missions
|
||||
drone.BackFlip();
|
||||
drone.Left(20);
|
||||
drone.Right(20);
|
||||
drone.Reverse(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Dynamic;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Tello_Drone
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class TestNameAttributes : Attribute
|
||||
{
|
||||
public TestNameAttributes(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
[assembly: InternalsVisibleTo("TelloDroneUnitTests")]
|
||||
namespace Tello_Drone
|
||||
{
|
||||
internal class UdpClientWrapper : IUdpClientWrapper
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System.Dynamic;
|
||||
|
||||
namespace Tello_Drone
|
||||
{
|
||||
public class UdpClientWrapperFactory : IUdpClientWrapperFactory
|
||||
|
||||
Reference in New Issue
Block a user