Have one last unit test

This commit is contained in:
2019-09-11 22:35:35 -06:00
parent 6e42363daf
commit cede87461f
16 changed files with 269 additions and 47 deletions

View File

@@ -1,5 +1,3 @@
using System.Dynamic;
namespace Tello_Drone
{
public interface IUdpClientWrapperFactory

View File

@@ -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()

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -9,6 +9,7 @@ namespace Tello_Drone.Missions
drone.BackFlip();
drone.Left(20);
drone.Right(20);
drone.Reverse(30);
}
}
}

View File

@@ -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; }
}
}

View File

@@ -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

View File

@@ -1,5 +1,3 @@
using System.Dynamic;
namespace Tello_Drone
{
public class UdpClientWrapperFactory : IUdpClientWrapperFactory