Changed UnitTests for further improvements on testing
This commit is contained in:
@@ -41,20 +41,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetSingle()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetSingle(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetSingle(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetSingleForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -63,16 +59,13 @@
|
||||
new() { Address = 101, HighByte = 0x01, LowByte = 0x02 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetSingle(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetSingle(0));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetSingle(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -82,14 +75,11 @@
|
||||
new() { Address = 100, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetSingle(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetSingle(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetSingleForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -99,10 +89,8 @@
|
||||
new InputRegister { Address = 101, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetSingle(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetSingle(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -145,20 +133,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetDouble()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetDouble(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetDouble(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetDoubleForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -169,16 +153,13 @@
|
||||
new() { Address = 102, HighByte = 0x7A, LowByte = 0xE1 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetDouble(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetDouble(0));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetDouble(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -190,14 +171,11 @@
|
||||
new() { Address = 103, HighByte = 0x47, LowByte = 0xAE }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetDouble(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetDouble(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetDoubleForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -209,10 +187,8 @@
|
||||
new InputRegister { Address = 103, HighByte = 0x47, LowByte = 0xAE }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetDouble(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetDouble(0));
|
||||
}
|
||||
|
||||
#endregion Modbus to value
|
||||
|
||||
@@ -30,16 +30,13 @@ namespace AMWD.Protocols.Modbus.Tests.Common.Extensions
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetBoolean()
|
||||
{
|
||||
// Arrange
|
||||
Coil coil = null;
|
||||
|
||||
// Act
|
||||
coil.GetBoolean();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => coil.GetBoolean());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -95,35 +92,28 @@ namespace AMWD.Protocols.Modbus.Tests.Common.Extensions
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnString()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] list = null;
|
||||
|
||||
// Act
|
||||
list.GetString(2);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => list.GetString(2));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnStringForEmptyList()
|
||||
{
|
||||
// Arrange
|
||||
var registers = Array.Empty<HoldingRegister>();
|
||||
|
||||
// Act
|
||||
registers.GetString(2);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetString(2));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnString(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -133,14 +123,11 @@ namespace AMWD.Protocols.Modbus.Tests.Common.Extensions
|
||||
new() { Address = 2, HighByte = 67, LowByte = 0 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetString(2, startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetString(2, startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnStringForMixedTypes()
|
||||
{
|
||||
// Arrange
|
||||
@@ -150,10 +137,8 @@ namespace AMWD.Protocols.Modbus.Tests.Common.Extensions
|
||||
new InputRegister { Address = 2, HighByte = 67, LowByte = 0 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetString(2);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetString(2));
|
||||
}
|
||||
|
||||
#endregion Modbus to value
|
||||
@@ -272,16 +257,13 @@ namespace AMWD.Protocols.Modbus.Tests.Common.Extensions
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetString()
|
||||
{
|
||||
// Arrange
|
||||
string str = null;
|
||||
|
||||
// Act
|
||||
_ = str.ToRegisters(100).ToArray();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => str.ToRegisters(100).ToArray());
|
||||
}
|
||||
|
||||
#endregion Value to Modbus
|
||||
|
||||
@@ -32,31 +32,23 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullForGetSByte()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister register = null;
|
||||
|
||||
// Act
|
||||
register.GetSByte();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => register.GetSByte());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentForGetSByte()
|
||||
{
|
||||
// Arrange
|
||||
var obj = new Coil();
|
||||
|
||||
// Act
|
||||
obj.GetSByte();
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => obj.GetSByte());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -86,31 +78,23 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullForGetInt16()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister register = null;
|
||||
|
||||
// Act
|
||||
register.GetInt16();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => register.GetInt16());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentForGetInt16()
|
||||
{
|
||||
// Arrange
|
||||
var obj = new Coil();
|
||||
|
||||
// Act
|
||||
obj.GetInt16();
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => obj.GetInt16());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -149,21 +133,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetInt32()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetInt32(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetInt32(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetInt32ForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -172,17 +151,13 @@
|
||||
new HoldingRegister { Address = 101, HighByte = 0x01, LowByte = 0x02 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt32(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetInt32(0));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetInt32(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -192,15 +167,11 @@
|
||||
new HoldingRegister { Address = 100, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt32(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetInt32(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetInt32ForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -210,11 +181,8 @@
|
||||
new InputRegister { Address = 101, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt32(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetInt32(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -257,21 +225,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetInt64()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetInt64(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetInt64(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetInt64ForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -282,17 +245,13 @@
|
||||
new HoldingRegister { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt64(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetInt64(0));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetInt64(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -304,15 +263,11 @@
|
||||
new HoldingRegister { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt64(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetInt64(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetInt64ForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -324,11 +279,8 @@
|
||||
new InputRegister { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetInt64(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetInt64(0));
|
||||
}
|
||||
|
||||
#endregion Modbus to value
|
||||
|
||||
@@ -32,29 +32,23 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullForGetByte()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister register = null;
|
||||
|
||||
// Act
|
||||
register.GetByte();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => register.GetByte());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentForGetByte()
|
||||
{
|
||||
// Arrange
|
||||
var obj = new Coil();
|
||||
|
||||
// Act
|
||||
obj.GetByte();
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => obj.GetByte());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -84,29 +78,23 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullForGetUInt16()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister register = null;
|
||||
|
||||
// Act
|
||||
register.GetUInt16();
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => register.GetUInt16());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentForGetUInt16()
|
||||
{
|
||||
// Arrange
|
||||
var obj = new Coil();
|
||||
|
||||
// Act
|
||||
obj.GetUInt16();
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => obj.GetUInt16());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -145,21 +133,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetUInt32()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetUInt32(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetUInt32(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetUInt32ForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -168,16 +151,13 @@
|
||||
new() { Address = 101, HighByte = 0x01, LowByte = 0x02 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt32(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetUInt32(1));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetUInt32(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -187,14 +167,11 @@
|
||||
new() { Address = 100, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt32(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetUInt32(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetUInt32ForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -204,10 +181,8 @@
|
||||
new InputRegister { Address = 101, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt32(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetUInt32(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -250,21 +225,16 @@
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void ShouldThrowNullOnGetUInt64()
|
||||
{
|
||||
// Arrange
|
||||
HoldingRegister[] registers = null;
|
||||
|
||||
// Act
|
||||
registers.GetUInt64(0);
|
||||
|
||||
// Assert - ArgumentNullException
|
||||
Assert.Fail();
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentNullException>(() => registers.GetUInt64(0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetUInt64ForLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -275,16 +245,13 @@
|
||||
new() { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt64(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetUInt64(0));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(1)]
|
||||
[DataRow(-1)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void ShouldThrowArgumentOutOfRangeOnGetUInt64(int startIndex)
|
||||
{
|
||||
// Arrange
|
||||
@@ -296,14 +263,11 @@
|
||||
new() { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt64(startIndex);
|
||||
|
||||
// Assert - ArgumentOutOfRangeException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => registers.GetUInt64(startIndex));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void ShouldThrowArgumentOnGetUInt64ForType()
|
||||
{
|
||||
// Arrange
|
||||
@@ -315,10 +279,8 @@
|
||||
new InputRegister { Address = 103, HighByte = 0x03, LowByte = 0x04 }
|
||||
};
|
||||
|
||||
// Act
|
||||
registers.GetUInt64(0);
|
||||
|
||||
// Assert - ArgumentException
|
||||
// Act + Assert
|
||||
Assert.ThrowsException<ArgumentException>(() => registers.GetUInt64(0));
|
||||
}
|
||||
|
||||
#endregion Modbus to value
|
||||
|
||||
Reference in New Issue
Block a user