public void TestReception_InputThroughTransponder_ExpectedTrue() { // Setup test data FormattedData result = null; List <string> testData = new List <string>(); // Creates list with manual value that is send through trigger from TransponderData to Formatter. string value = "ATR423;39045;12932;14000;20151006213456789"; testData.Add(value); _uut.FormattedDataReady += (o, e) => { result = e.FormattedData; }; //Simulates formatted data ready event // Act: Trigger the fake object to execute event invocation _fakeTransponderReceiver.TransponderDataReady += Raise.EventWith(this, new RawTransponderDataEventArgs(testData)); DateTime date = new DateTime(2015, 10, 06, 21, 34, 56, 789); // Assert that result and expected are equal Assert.AreEqual(result.Tag, "ATR423"); Assert.AreEqual(result.XCoordinate, 39045); Assert.AreEqual(result.YCoordinate, 12932); Assert.AreEqual(result.Altitude, 14000); Assert.AreEqual(result.TimeStamp, date); Assert.AreEqual(result.CompassCourse, ""); Assert.AreEqual(result.Speed, 0); }
public void IsThereConflict_ExpectedTrue() { FormattedData test1 = new FormattedData("Test1", 20000, 20000, 2000, DateTime.Today, "Nord", 0); FormattedData test2 = new FormattedData("Test2", 16000, 16000, 1800, DateTime.Today, "Nord", 0); Assert.That(_uut.AreAircraftsInConflict(test1, test2) == true); }
public void FormatData_Tag_ManualInputTest_ExpectedTrue() { string data = "MAT218;1000;20000;10000;20190703120610123"; FormattedData result = _uut.FormatData(data); Assert.AreEqual(result.Tag, "MAT218"); }
public void AreAircraftsInConflict_ManualInputTestOfAbsValue_ExpectedFalse() { FormattedData test1 = new FormattedData("Test2", 26000, 26000, 2500, DateTime.Today, "Nord", 0); FormattedData test2 = new FormattedData("Test1", 20000, 20000, 2000, DateTime.Today, "Nord", 0); Assert.That(_uut.AreAircraftsInConflict(test1, test2) == false); }
public void Test_PositionReturnsNord() { FormattedData test1 = new FormattedData("test1", 60, 34, 0, DateTime.Today, "North", 0); string expected = "North"; string actual = _uut.CalculatePosition(test1); Assert.AreEqual(expected, actual); }
public void Test_PositionReturnsSyd() { FormattedData test3 = new FormattedData("test3", 60, 71, 0, DateTime.Today, "South", 0); string expected = "South"; string actual = _uut.CalculatePosition(test3); Assert.AreEqual(expected, actual); }
public void Test_PositionReturnsVest() { FormattedData test4 = new FormattedData("test4", 60, 120, 0, DateTime.Today, "West", 0); string expected = "West"; string actual = _uut.CalculatePosition(test4); Assert.AreEqual(expected, actual); }
public void Add_ManualAdditionOfAircraft_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 20); _uut.Add(test1, test2); Assert.That(_uut.GetConflictList().Count == 1); Assert.That(writer.WasWriterCalled == true); }
public void TestReception_InputThroughTransponderSameAirplaneDifferentPositions_ExpectedFalse() { FormattedData result = null; DateTime date = new DateTime(2015, 10, 06, 21, 34, 56, 780); FormattedData value = new FormattedData("ATR423", 39045, 12932, 14000, date, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value)); Assert.That(_seperationCalculator.IsThereConflict(value) == false); }
public void TestReception_InputThroughTransponderOneAircraft_ExpectedTrue() { FormattedData result = null; DateTime date = new DateTime(2015, 10, 06, 21, 34, 56, 780); FormattedData value = new FormattedData("ATR423", 39045, 12932, 14000, date, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value)); Assert.That(_seperationCalculator.GetAircraftList().Count == 1); }
public void AreAircraftsInConflict_InputThroughList_ExpectedFalse() { FormattedData test1 = new FormattedData("Test1", 30000, 30000, 3000, DateTime.Today, "Nord", 0); _uut.Add(test1); FormattedData test2 = new FormattedData("Test2", 16000, 16000, 1800, DateTime.Today, "Nord", 0); _uut.Add(test2); Assert.That(_uut.IsThereConflict(test1) == false); }
/// <summary> /// /// </summary> /// <param name="d"></param> /// <param name="openPrincipal"></param> /// <param name="previousDay"></param> public OneDayState(DateTime d, decimal openPrincipal, OneDayState previousDay) { //IsReschedulingDay = false; //IsBetweenLastPaymentAndReschedulingDay = false; Date = d; OpenPrincipalForInterest = openPrincipal; OpenPrincipalAfterRepayments = openPrincipal; AssignedFees = 0; DailyInterestRate = 0; this.previousDay = previousDay; Str = new FormattedData(this); } // constructor
public void CalculateHours_TenMinutesInSeconds_ExpectedTrue() { DateTime dateTime1 = new DateTime(2019, 03, 24, 21, 48, 20, 034); DateTime dateTime2 = new DateTime(2019, 03, 24, 21, 38, 20, 034); FormattedData currentData = new FormattedData("Current data", 20000, 1000, 2000, dateTime1, "South", 2000); FormattedData oldData = new FormattedData("Old data", 10000, 100, 1000, dateTime2, "South", 10000); double expected = 600; double actual = _uut.CalculateHours(currentData, oldData); Assert.AreEqual(expected, actual); }
public void Speed_ExpectedTrue_OneMinute() { DateTime dateTime1 = new DateTime(2019, 03, 24, 21, 48, 20, 034); DateTime dateTime2 = new DateTime(2019, 03, 24, 21, 47, 20, 034); FormattedData currentData = new FormattedData("Current data", 20000, 1000, 2000, dateTime1, "South", 0); FormattedData oldData = new FormattedData("Old data", 150, 50, 500, dateTime2, "South", 0); double expected = 332.154; double actual = _uut.CalculateSpeed(currentData, oldData); Assert.AreEqual(expected, actual); }
public void Add_ManualAdditionOfAircraft_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 20); _uut.Add(test1, test2); FormattedData test3 = new FormattedData("test3", 3, 3, 3, DateTime.Today, "øst", 30); FormattedData test4 = new FormattedData("test4", 4, 4, 4, DateTime.Today, "vest", 40); _uut.Add(test3, test4); Assert.That(_uut.GetConflictList().Count == 2); }
public void AreAircraftsInConflict_OnlyOnePointOfConflictVertical_ExpectedFalse() { FormattedData test1 = new FormattedData("Test1", 30000, 30000, 3000, DateTime.Today, "Nord", 0); _uut.Add(test1); FormattedData test2 = new FormattedData("Test2", 16000, 16000, 1800, DateTime.Today, "Nord", 0); _uut.Add(test2); FormattedData test3 = new FormattedData("Test3", 24000, 10000, 1600, DateTime.Today, "Nord", 0); Assert.That(_uut.IsThereConflict(test3) == false); }
public void Speed_ExpectedTrue_OneHour() { DateTime dateTime1 = new DateTime(2019, 03, 24, 22, 48, 20, 034); DateTime dateTime2 = new DateTime(2019, 03, 24, 21, 48, 20, 034); FormattedData currentData = new FormattedData("Current data", 300000, 300000, 2000, dateTime1, "South", 0); FormattedData oldData = new FormattedData("Old data", 0, 0, 500, dateTime2, "South", 0); double expected = 117.852; double actual = _uut.CalculateSpeed(currentData, oldData); Assert.AreEqual(expected, actual); //Assert.AreEqual(_uut.CalculateSpeed(currentData, oldData), 0); }
public void Speed_ExpectedTrue_TenMinutes() { DateTime dateTime1 = new DateTime(2019, 03, 24, 21, 48, 20, 034); DateTime dateTime2 = new DateTime(2019, 03, 24, 21, 38, 20, 034); FormattedData currentData = new FormattedData("Current data", 300000, 200000, 20000, dateTime1, "South", 0); FormattedData oldData = new FormattedData("Old data", 1000, 10000, 10000, dateTime2, "South", 0); double expected = 590.671; double actual = _uut.CalculateSpeed(currentData, oldData); Assert.AreEqual(expected, actual); //Assert.AreEqual(_uut.CalculateSpeed(currentData, oldData), 0); }
public void IsAircraftInAirspace_AircraftIsInAirspace_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); _uut.Add(test1); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 22); _uut.Add(test2); FormattedData test3 = new FormattedData("test3", 3, 3, 3, DateTime.Today, "øst", 30); _uut.Add(test3); Assert.That(_uut.IsAircraftInAirspace(test3) == true); }
public void Add_AddAircraftToList_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); _uut.Add(test1); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 20); _uut.Add(test2); FormattedData test3 = new FormattedData("test3", 3, 3, 3, DateTime.Today, "øst", 30); _uut.Add(test3); Assert.AreEqual(_uut.GetAircraftList().Count, 3); }
public void IsAircraftInAirspace_AircraftIsNotInAirspace_ExpectedFalse() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); _uut.Add(test1); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 22); _uut.Add(test2); FormattedData test3 = new FormattedData("test3", 3, 3, 3, DateTime.Today, "øst", 30); _uut.Add(test3); FormattedData test4 = new FormattedData("test4", 4, 4, 4, DateTime.Today, "vest", 40); Assert.That(_uut.IsAircraftInAirspace(test4) == false); }
public void EvaluateData_AircraftIsInAirspaceWithDifferentPosition_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); _uut.Add(test1); FormattedData test2 = new FormattedData("test2", 2, 2, 2, DateTime.Today, "syd", 22); _uut.Add(test2); FormattedData test3 = new FormattedData("test3", 3, 3, 3, DateTime.Today, "øst", 30); _uut.Add(test3); FormattedData test1_new = new FormattedData("test1", 4, 4, 4, DateTime.Today, "vest", 40); Assert.That(_uut.IsAircraftInAirspace(test1_new) == true); }
public void TestReception_InputThroughTransponderAirplaneInConflictHorizontal_ExpectedFalse() { DateTime date = new DateTime(2015, 10, 06, 21, 34, 56, 789); FormattedData value = new FormattedData("PPL120", 29045, 22932, 24000, date, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value)); DateTime date2 = new DateTime(2015, 10, 06, 21, 34, 56, 780); FormattedData value2 = new FormattedData("ATR423", 39045, 12932, 14000, date2, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value2)); DateTime date3 = new DateTime(2015, 10, 06, 21, 39, 02, 999); FormattedData value3 = new FormattedData("QUR421", 47045, 12932, 16000, date3, "", 0); Assert.That(_seperationCalculator.IsThereConflict(value3) == false); }
public void Add_CompareAircraftInList_ExpectedTrue() { FormattedData test1 = new FormattedData("test1", 1, 1, 1, DateTime.Today, "nord", 10); _uut.Add(test1); FormattedData result = new FormattedData("0", 0, 0, 0, DateTime.Today, "0", 0); foreach (FormattedData test in _uut.GetAircraftList()) { result = test; } Assert.AreEqual(test1.Tag, result.Tag); Assert.AreEqual(test1.XCoordinate, result.XCoordinate); Assert.AreEqual(test1.YCoordinate, result.YCoordinate); Assert.AreEqual(test1.Altitude, result.Altitude); Assert.AreEqual(test1.TimeStamp, result.TimeStamp); Assert.AreEqual(test1.CompassCourse, result.CompassCourse); Assert.AreEqual(test1.Speed, result.Speed); }
public void TestReception_InputThroughTransponderSameAircraftNewPosition_ExpectedTrue() { DateTime date = new DateTime(2015, 10, 06, 21, 34, 56, 780); FormattedData value = new FormattedData("ATR423", 39045, 12932, 14000, date, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value)); DateTime date2 = new DateTime(2015, 10, 06, 21, 34, 56, 789); FormattedData value2 = new FormattedData("PPL120", 29045, 22932, 24000, date2, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value2)); DateTime date3 = new DateTime(2015, 10, 06, 21, 39, 02, 999); FormattedData value3 = new FormattedData("ATR423", 19045, 12932, 34000, date3, "", 0); _formatter.FormattedDataReady += Raise.EventWith(this, new FormattedDataEventArgs(value3)); Assert.That(_seperationCalculator.GetAircraftList().Count == 2); }
public void Test_Coordinate_Returns_Øst(int x, int y, string expectedCourse) { FormattedData currentData = new FormattedData("test", x, y, 0, "0", "", 0); Assert.That(_uut.CalculatePosition(currentData) == expectedCourse); }