Code inspections
This commit is contained in:
@@ -86,7 +86,11 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
{
|
{
|
||||||
var actionName = "Action";
|
var actionName = "Action";
|
||||||
|
|
||||||
Assert.Throws<ActionNotImplementedException>(() => { var actualResult = _focuser.Action(actionName, string.Empty); });
|
Assert.Throws<ActionNotImplementedException>(() =>
|
||||||
|
{
|
||||||
|
var actualResult = _focuser.Action(actionName, string.Empty);
|
||||||
|
Assert.Fail($"{actualResult} should not have a value");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -277,7 +281,11 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void Absolute_Get_WhenNotConnected_ThenThrowsException()
|
public void Absolute_Get_WhenNotConnected_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var exception = Assert.Throws<NotConnectedException>(() => { var result = _focuser.Absolute; });
|
var exception = Assert.Throws<NotConnectedException>(() =>
|
||||||
|
{
|
||||||
|
var result = _focuser.Absolute;
|
||||||
|
Assert.Fail($"{result} should not have a value");
|
||||||
|
});
|
||||||
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Absolute Get"));
|
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Absolute Get"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,14 +421,22 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void Position_WhenCalled_ThenThrowsException()
|
public void Position_WhenCalled_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.Position; });
|
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
|
||||||
|
{
|
||||||
|
var result = _focuser.Position;
|
||||||
|
Assert.Fail($"{result} should not have a value");
|
||||||
|
});
|
||||||
Assert.That(exception.Message, Is.EqualTo("Property read Position is not implemented in this driver."));
|
Assert.That(exception.Message, Is.EqualTo("Property read Position is not implemented in this driver."));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void StepSize_WhenCalled_ThenThrowsException()
|
public void StepSize_WhenCalled_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.StepSize; });
|
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
|
||||||
|
{
|
||||||
|
var result = _focuser.StepSize;
|
||||||
|
Assert.Fail($"{result} should not have a value");
|
||||||
|
});
|
||||||
Assert.That(exception.Message, Is.EqualTo("Property read StepSize is not implemented in this driver."));
|
Assert.That(exception.Message, Is.EqualTo("Property read StepSize is not implemented in this driver."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +464,11 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void Temperature_WhenCalled_ThenThrowsException()
|
public void Temperature_WhenCalled_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.Temperature; });
|
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
|
||||||
|
{
|
||||||
|
var result = _focuser.Temperature;
|
||||||
|
Assert.Fail($"{result} should not have a value");
|
||||||
|
});
|
||||||
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
|
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,9 +363,6 @@ namespace ASCOM.Meade.net
|
|||||||
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// For each of the driver assemblies
|
// For each of the driver assemblies
|
||||||
@@ -432,9 +429,7 @@ namespace ASCOM.Meade.net
|
|||||||
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
bFail = true;
|
bFail = true;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
|
||||||
if (bFail) break;
|
if (bFail) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,32 +34,73 @@ namespace ASCOM.Meade.net
|
|||||||
static extern bool BringWindowToTop(IntPtr hWnd);
|
static extern bool BringWindowToTop(IntPtr hWnd);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, Int32 nMaxCount);
|
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, Int32 nMaxCount);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private static extern int GetWindowThreadProcessId(IntPtr hWnd, ref Int32 lpdwProcessId);
|
private static extern int GetWindowThreadProcessId(IntPtr hWnd, ref Int32 lpdwProcessId);
|
||||||
|
|
||||||
[DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
public static extern IntPtr GetParent(IntPtr hWnd);
|
public static extern IntPtr GetParent(IntPtr hWnd);
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private const int SW_HIDE = 0;
|
private const int SW_HIDE = 0;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWNORMAL = 1;
|
private const int SW_SHOWNORMAL = 1;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private const int SW_NORMAL = 1;
|
private const int SW_NORMAL = 1;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWMINIMIZED = 2;
|
private const int SW_SHOWMINIMIZED = 2;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWMAXIMIZED = 3;
|
private const int SW_SHOWMAXIMIZED = 3;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private const int SW_MAXIMIZE = 3;
|
private const int SW_MAXIMIZE = 3;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWNOACTIVATE = 4;
|
private const int SW_SHOWNOACTIVATE = 4;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
private const int SW_SHOW = 5;
|
private const int SW_SHOW = 5;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private const int SW_MINIMIZE = 6;
|
private const int SW_MINIMIZE = 6;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWMINNOACTIVE = 7;
|
private const int SW_SHOWMINNOACTIVE = 7;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWNA = 8;
|
private const int SW_SHOWNA = 8;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
private const int SW_RESTORE = 9;
|
private const int SW_RESTORE = 9;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SW_SHOWDEFAULT = 10;
|
private const int SW_SHOWDEFAULT = 10;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once UnusedMember.Local
|
||||||
private const int SW_MAX = 10;
|
private const int SW_MAX = 10;
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const uint SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000;
|
private const uint SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000;
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const uint SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001;
|
private const uint SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001;
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
// ReSharper disable once IdentifierTypo
|
||||||
private const int SPIF_SENDCHANGE = 0x2;
|
private const int SPIF_SENDCHANGE = 0x2;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user