Files
Delphi-Project-Manager/DelphiProjectHandler.Tests/UnitFormReaderClassTests.cs
T
2012-09-24 20:55:07 +02:00

60 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using NUnit.Framework;
using DelphiProjectHandler;
namespace DelphiProjectHandler.Tests
{
[TestFixture]
public class UnitFormReaderClassTests
{
protected void TestGetBinaryFormName(string iTestValue, string iExpected, string iMessage)
{
string vActual = UnitFormReader.GetBinaryFormName(iTestValue);
Assert.AreEqual(iExpected, vActual, iMessage);
}
[Test]
public void GetBinaryFormName()
{
#region (Test values)
string vTestValue1 = @"ÿ TFRMACFTDISCREPANCIES 0É TPF0ñTfrmAcftDiscrepanciesfrmAcftDiscrepanciesLeftî TopiWidth™Height¸ CaptionAircraft DiscrepanciesVisibleOnClose FormClose OnCloseQueryFormCloseQuery";
string vTestValue2 = @"ÿ TFRMAIRCRAFTINFO 02 TPF0TfrmAircraftInfofrmAircraftInfoLeftÖ Top";
string vTestValue3 = @"ÿ TFRMBASESI 0í TPF0ñTfrmBaseSI frmBaseSILeftUTop° CaptionfrmBa";
#endregion
TestGetBinaryFormName(vTestValue1, "frmAcftDiscrepancies", "1");
TestGetBinaryFormName(vTestValue2, "frmAircraftInfo", "2");
TestGetBinaryFormName(vTestValue3, "frmBaseSI", "3");
}
[Test]
[ExpectedException(typeof(Exception))]
public void GetBinaryFormName_FormNameIsLast()
{
string vTestValue = @"ÿ TFRMBASESI 0í TPF0ñTfrmBase";
TestGetBinaryFormName(vTestValue, "", "");
}
[Test]
[ExpectedException(typeof(Exception))]
public void GetBinaryFromName_WithoutMarker()
{
string vTestValue = @"ÿ TFRMACFTDISCREPANCIES 0É ñTfrmAcftDiscrepanciesfrmAcftDiscrepanciesLeftî TopiWidth™Height¸ CaptionAircraft DiscrepanciesVisibleOnClose FormClose OnCloseQueryFormCloseQuery";
TestGetBinaryFormName(vTestValue, "", "");
}
[Test]
[ExpectedException(typeof(Exception))]
public void GetBinaryFormName_WithoutFormName()
{
string vTestValue = @"ÿ TFRMACFTDISCREPANCIES 0É TPF0ñ";
TestGetBinaryFormName(vTestValue, "", "");
}
}
}