Code inspections

This commit is contained in:
2019-09-28 22:45:34 +01:00
parent ca982edbf8
commit 101784adb3
2 changed files with 105 additions and 22 deletions
@@ -105,7 +105,10 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void Action_WhenNotConnected_ThrowsNotConnectedException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var actualResult = _telescope.Action(string.Empty, string.Empty); });
var exception = Assert.Throws<NotConnectedException>(() =>
{
_telescope.Action(string.Empty, string.Empty);
});
Assert.That(exception.Message,Is.EqualTo("Not connected to telescope when trying to execute: Action"));
}
@@ -552,7 +555,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void AlignmentMode_Get_WhenNotConnected_ThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var actualResult = _telescope.AlignmentMode; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var actualResult = _telescope.AlignmentMode;
Assert.Fail($"{actualResult} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: AlignmentMode Get"));
}
@@ -577,7 +584,11 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
Assert.Throws<InvalidValueException>(() => { var actualResult = _telescope.AlignmentMode; });
Assert.Throws<InvalidValueException>(() =>
{
var actualResult = _telescope.AlignmentMode;
Assert.Fail($"{actualResult} should not have returned");
});
}
[Test]
@@ -617,7 +628,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void ApertureArea_Get_ThrowsNotImplementedException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.ApertureArea; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.ApertureArea;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("ApertureArea"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -626,7 +641,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void ApertureDiameter_Get_ThrowsNotImplementedException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.ApertureDiameter; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.ApertureDiameter;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("ApertureDiameter"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -714,7 +733,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void CanSetGuideRates_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.CanSetGuideRates; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.CanSetGuideRates;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: CanSetGuideRates Get"));
}
@@ -883,7 +906,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void Declination_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var actualResult = _telescope.Declination; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var actualResult = _telescope.Declination;
Assert.Fail($"{actualResult} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: Declination Get"));
}
@@ -921,7 +948,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void DestinationSideOfPier_ThenThrowsException()
{
var excpetion = Assert.Throws<MethodNotImplementedException>(() => { var result = _telescope.DestinationSideOfPier(0,0); });
var excpetion = Assert.Throws<MethodNotImplementedException>(() =>
{
var result = _telescope.DestinationSideOfPier(0,0);
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Method, Is.EqualTo("DestinationSideOfPier"));
}
@@ -929,7 +960,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void DoesRefraction_Get_ThenThrowsException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.DoesRefraction; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.DoesRefraction;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("DoesRefraction"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -963,7 +998,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void FocalLength_Get_ThenThrowsException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.FocalLength; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.FocalLength;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("FocalLength"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -1300,7 +1339,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void RightAscension_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.RightAscension; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.RightAscension;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: RightAscension Get"));
}
@@ -1351,7 +1394,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SideOfPier_Get_ThenThrowsException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.SideOfPier; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.SideOfPier;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("SideOfPier"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -1369,7 +1416,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SiteElevation_Get_ThenThrowsException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.SiteElevation; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.SiteElevation;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("SiteElevation"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -1387,7 +1438,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SlewSettleTime_Get_ThenThrowsException()
{
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.SlewSettleTime; });
var excpetion = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _telescope.SlewSettleTime;
Assert.Fail($"{result} should not have returned");
});
Assert.That(excpetion.Property, Is.EqualTo("SlewSettleTime"));
Assert.That(excpetion.AccessorSet, Is.False);
@@ -1413,7 +1468,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SiteLatitude_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.SiteLatitude; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.SiteLatitude;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: SiteLatitude Get"));
}
@@ -1488,7 +1547,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SiteLongitude_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.SiteLongitude; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.SiteLongitude;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: SiteLongitude Get"));
}
@@ -1659,7 +1722,11 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
var exception = Assert.Throws<InvalidOperationException>(() => { var result = _telescope.TargetDeclination; });
var exception = Assert.Throws<InvalidOperationException>(() =>
{
var result = _telescope.TargetDeclination;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Target not set"));
}
@@ -1733,7 +1800,11 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
var exception = Assert.Throws<InvalidOperationException>(() => { var result = _telescope.TargetRightAscension; });
var exception = Assert.Throws<InvalidOperationException>(() =>
{
var result = _telescope.TargetRightAscension;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Target not set"));
}
@@ -1830,7 +1901,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void UTCDate_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.UTCDate; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.UTCDate;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: UTCDate Get"));
}
@@ -2315,7 +2390,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void Azimuth_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.Azimuth; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.Azimuth;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: Azimuth Get"));
}
@@ -2356,7 +2435,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void Altitude_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _telescope.Altitude; });
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _telescope.Altitude;
Assert.Fail($"{result} should not have returned");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: Altitude Get"));
}