@@ -12,12 +12,12 @@ namespace AntPlus.UnitTests.DeviceProfiles.BicyclePower
1212 [ TestClass ]
1313 public class CalibrationTests
1414 {
15- private MockRepository ? mockRepository ;
15+ private MockRepository mockRepository ;
1616
17- private Bicycle ? mockBicycle ;
17+ private Bicycle mockBicycle ;
1818 private readonly ChannelId mockChannelId = new ( 0 ) ;
19- private Mock < IAntChannel > ? mockAntChannel ;
20- private Mock < ILogger < Bicycle > > ? mockLogger ;
19+ private Mock < IAntChannel > mockAntChannel ;
20+ private Mock < ILogger < Bicycle > > mockLogger ;
2121
2222 [ TestInitialize ]
2323 public void TestInitialize ( )
@@ -32,8 +32,8 @@ private Bicycle CreateBicyclePower()
3232 {
3333 return new Bicycle (
3434 mockChannelId ,
35- mockAntChannel ? . Object ,
36- mockLogger ? . Object ) ;
35+ mockAntChannel . Object ,
36+ mockLogger . Object ) ;
3737 }
3838
3939 private Calibration CreateCalibration ( )
@@ -54,7 +54,7 @@ public void Parse_AutoZeroSupport_ExpectedAutoZeroSupport(int config, bool suppo
5454 byte [ ] dataPage = new byte [ 8 ] { 0x01 , 0x12 , ( byte ) config , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ;
5555
5656 // Act
57- mockBicycle ? . Parse (
57+ mockBicycle . Parse (
5858 dataPage ) ;
5959
6060 // Assert
@@ -75,7 +75,7 @@ public void Parse_GeneralCalibrationResponse_ExpectedResponse(byte[] dataPage, C
7575 var calibration = CreateCalibration ( ) ;
7676
7777 // Act
78- mockBicycle ? . Parse (
78+ mockBicycle . Parse (
7979 dataPage ) ;
8080
8181 // Assert
@@ -94,7 +94,7 @@ public void Parse_CustomCalibration_ExpectedCustomParameters(int calID)
9494 byte [ ] dataPage = new byte [ 8 ] { 1 , ( byte ) calID , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 } ;
9595
9696 // Act
97- mockBicycle ? . Parse (
97+ mockBicycle . Parse (
9898 dataPage ) ;
9999
100100 // Assert
@@ -114,7 +114,7 @@ public void Parse_MeasurementOutputData_ExpectedDataType(int val, MeasurementOut
114114 byte [ ] dataPage = new byte [ 8 ] { 3 , 0x00 , ( byte ) val , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ;
115115
116116 // Act
117- mockBicycle ? . Parse (
117+ mockBicycle . Parse (
118118 dataPage ) ;
119119
120120 // Assert
@@ -126,21 +126,21 @@ public void Parse_MeasurementOutputData_ExpectedDataType(int val, MeasurementOut
126126 [ DataRow ( sbyte . MaxValue , short . MaxValue ) ]
127127 [ DataRow ( sbyte . MinValue , short . MinValue ) ]
128128 [ DataRow ( sbyte . MaxValue , short . MinValue ) ]
129- public void Parse_MeasurementOutputData_ExpectedScaledMeasurement ( int scale , int meas )
129+ public void Parse_MeasurementOutputData_ExpectedScaledMeasurement ( int scale , int measurement )
130130 {
131131 // Arrange
132132 var calibration = CreateCalibration ( ) ;
133133 byte [ ] dataPage = new byte [ 8 ] { 3 , 0x00 , 0x00 , ( byte ) scale , 0x00 , 0x00 , 0x00 , 0x00 } ;
134- dataPage [ 6 ] = BitConverter . GetBytes ( ( short ) meas ) [ 0 ] ;
135- dataPage [ 7 ] = BitConverter . GetBytes ( ( short ) meas ) [ 1 ] ;
136- double expMeas = meas * Math . Pow ( 2 , scale ) ;
134+ dataPage [ 6 ] = BitConverter . GetBytes ( ( short ) measurement ) [ 0 ] ;
135+ dataPage [ 7 ] = BitConverter . GetBytes ( ( short ) measurement ) [ 1 ] ;
136+ double expMeasurement = measurement * Math . Pow ( 2 , scale ) ;
137137
138138 // Act
139- mockBicycle ? . Parse (
139+ mockBicycle . Parse (
140140 dataPage ) ;
141141
142142 // Assert
143- Assert . AreEqual ( expMeas , calibration . Measurements [ 0 ] . Measurement ) ;
143+ Assert . AreEqual ( expMeasurement , calibration . Measurements [ 0 ] . Measurement ) ;
144144 }
145145
146146 [ TestMethod ]
@@ -156,7 +156,7 @@ public void Parse_MeasurementOutputData_ExpectedTimestamp(int timeStamp, double
156156 dataPage [ 5 ] = BitConverter . GetBytes ( ( ushort ) timeStamp ) [ 1 ] ;
157157
158158 // Act
159- mockBicycle ? . Parse (
159+ mockBicycle . Parse (
160160 dataPage ) ;
161161
162162 // Assert
@@ -168,7 +168,7 @@ public async Task RequestManualCalibration_Request_ExpectedMessage()
168168 {
169169 // Arrange
170170 var calibration = CreateCalibration ( ) ;
171- mockAntChannel ? . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xAA , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
171+ mockAntChannel . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xAA , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
172172 It . IsAny < uint > ( ) ) . Result )
173173 . Returns ( MessagingReturnCode . Pass ) ;
174174
@@ -178,7 +178,7 @@ public async Task RequestManualCalibration_Request_ExpectedMessage()
178178 // Assert
179179 Assert . AreEqual ( MessagingReturnCode . Pass , result ) ;
180180 Assert . AreEqual ( CalibrationResponse . InProgress , calibration . CalibrationStatus ) ;
181- mockRepository ? . VerifyAll ( ) ;
181+ mockRepository . VerifyAll ( ) ;
182182 }
183183
184184 [ TestMethod ]
@@ -189,7 +189,7 @@ public async Task SetAutoZeroConfiguration_StateUnderTest_ExpectedBehavior(AutoZ
189189 {
190190 // Arrange
191191 var calibration = CreateCalibration ( ) ;
192- mockAntChannel ? . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xAB , ( byte ) autoZero , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
192+ mockAntChannel . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xAB , ( byte ) autoZero , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
193193 It . IsAny < uint > ( ) ) . Result )
194194 . Returns ( MessagingReturnCode . Pass ) ;
195195
@@ -200,15 +200,15 @@ public async Task SetAutoZeroConfiguration_StateUnderTest_ExpectedBehavior(AutoZ
200200 // Assert
201201 Assert . AreEqual ( MessagingReturnCode . Pass , result ) ;
202202 Assert . AreEqual ( CalibrationResponse . Unknown , calibration . CalibrationStatus ) ;
203- mockRepository ? . VerifyAll ( ) ;
203+ mockRepository . VerifyAll ( ) ;
204204 }
205205
206206 [ TestMethod ]
207207 public async Task RequestCustomParameters_Request_ExpectedMessage ( )
208208 {
209209 // Arrange
210210 var calibration = CreateCalibration ( ) ;
211- mockAntChannel ? . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xBA , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
211+ mockAntChannel . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , new byte [ ] { 0x01 , 0xBA , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
212212 It . IsAny < uint > ( ) ) . Result )
213213 . Returns ( MessagingReturnCode . Pass ) ;
214214
@@ -218,7 +218,7 @@ public async Task RequestCustomParameters_Request_ExpectedMessage()
218218 // Assert
219219 Assert . AreEqual ( MessagingReturnCode . Pass , result ) ;
220220 Assert . AreEqual ( CalibrationResponse . InProgress , calibration . CalibrationStatus ) ;
221- mockRepository ? . VerifyAll ( ) ;
221+ mockRepository . VerifyAll ( ) ;
222222 }
223223
224224 [ TestMethod ]
@@ -227,7 +227,7 @@ public async Task SetCustomParameters_Parameters_ExpectedMessage()
227227 // Arrange
228228 var calibration = CreateCalibration ( ) ;
229229 byte [ ] customParameters = new byte [ ] { 0x01 , 0xBC , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 , 0x66 } ;
230- mockAntChannel ? . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , customParameters ,
230+ mockAntChannel . Setup ( ac => ac . SendExtAcknowledgedData ( mockChannelId , customParameters ,
231231 It . IsAny < uint > ( ) ) . Result )
232232 . Returns ( MessagingReturnCode . Pass ) ;
233233
@@ -238,7 +238,7 @@ public async Task SetCustomParameters_Parameters_ExpectedMessage()
238238 // Assert
239239 Assert . AreEqual ( MessagingReturnCode . Pass , result ) ;
240240 Assert . AreEqual ( CalibrationResponse . InProgress , calibration . CalibrationStatus ) ;
241- mockRepository ? . VerifyAll ( ) ;
241+ mockRepository . VerifyAll ( ) ;
242242 }
243243 }
244244}
0 commit comments