public void EmptySerialDyn() { DeviceScanJSON testJson = new DeviceScanJSON(); testJson.i = ""; testJson.d = TestGlobals.validDynCode + "90210|"; testJson.b = null; testJson.s = 4; Uri uri = new Uri(TestGlobals.testServer, "/api/DeviceScan/"); results.WriteLine(DateTime.Now); AsyncContext.Run(async () => await new HTTPSCalls().RunPostAsync(uri, testJson)); string statusCode = HTTPSCalls.result.Key.Property("StatusCode").Value.ToString(); results.WriteLine("Json posted:"); results.WriteLine(testJson.ToString()); results.WriteLine("Server: " + TestGlobals.testServer); results.WriteLine("Expected result: 400"); results.WriteLine("Actual result: " + statusCode); results.WriteLine("Test result: " + HTTPSCalls.result.Key.ToString()); results.WriteLine(); Assert.AreEqual("400", statusCode); }
public void ValidScansSimDyn() { DeviceScanJSON testJson = new DeviceScanJSON(); testJson.i = TestGlobals.validSerial; testJson.d = null; string[] scanData = new string[4]; scanData[0] = TestGlobals.validDynCode + "0|"; scanData[1] = "123456789"; scanData[2] = TestGlobals.validDynCode + "2|"; scanData[3] = "987654321"; testJson.b = scanData; testJson.s = 4; Uri uri = new Uri(TestGlobals.testServer, "/api/DeviceScan/"); results.WriteLine(DateTime.Now); AsyncContext.Run(async () => await new HTTPSCalls().RunPostAsync(uri, testJson)); string statusCode = HTTPSCalls.result.Key.Property("StatusCode").Value.ToString(); results.WriteLine("Json posted:"); results.WriteLine(testJson.ToString()); results.WriteLine("Server: " + TestGlobals.testServer); results.WriteLine("Expected result: 201"); results.WriteLine("Actual result: " + statusCode); results.WriteLine("Test result: " + HTTPSCalls.result.Key.ToString()); results.WriteLine(HTTPSCalls.result.Value); results.WriteLine(); Assert.AreEqual("201", statusCode); }