public void Test_RobotPositionService_GetGridIdentifer() { IDataService dataService = new DataService(); IRobotPositionService service = new RobotPositionService(dataService); IGridCoordinate gridCoordinate = new GridCoordinate { MaxXCoordinate = 5, MaxYCoordinate = 3 }; IGridIdentifer gridIdentifer = service.GetGridIdentifer(gridCoordinate); Assert.AreEqual(1, gridIdentifer.GridID); }
public void Test_RobotPositionWebAPI_EndPoint1_Grid() { IGridCoordinate gridCoordinate = new GridCoordinate { MaxXCoordinate = 5, MaxYCoordinate = 3 }; string endPointURI = (new Uri(baseUri, "grid")).ToString(); using (var client = new HttpClient()) { var response = client.PostAsync(endPointURI, GetStringContent(gridCoordinate)).Result; Assert.IsTrue(response.IsSuccessStatusCode); if (response.IsSuccessStatusCode) { IGridIdentifer gridId = JsonConvert.DeserializeObject <GridIdentifer>(response.Content.ReadAsStringAsync().Result); Assert.AreEqual(1, gridId.GridID); } } }
public async Task Test_DataService_GetGridIdentiferAsync() { IGridCoordinate gridCoordinate1 = new GridCoordinate { MaxXCoordinate = 4, MaxYCoordinate = 3 }; IGridIdentifer gridIdentifer1 = await dataService.GetGridIdentiferAsync(gridCoordinate1); Assert.AreEqual(3, gridIdentifer1.GridID); //Should be still 1 if the data is existing. IGridCoordinate gridCoordinate2 = new GridCoordinate { MaxXCoordinate = 4, MaxYCoordinate = 3 }; IGridIdentifer gridIdentifer2 = await dataService.GetGridIdentiferAsync(gridCoordinate2); Assert.AreEqual(3, gridIdentifer2.GridID); IGridCoordinate gridCoordinate3 = new GridCoordinate { MaxXCoordinate = 4, MaxYCoordinate = 5 }; var gridIdentifer3 = await dataService.GetGridIdentiferAsync(gridCoordinate3); Assert.AreEqual(4, gridIdentifer3.GridID); }
public void Test_DataService_GetGridIdentifer() { IGridCoordinate gridCoordinate1 = new GridCoordinate { MaxXCoordinate = 5, MaxYCoordinate = 3 }; IGridIdentifer gridIdentifer1 = dataService.GetGridIdentifer(gridCoordinate1); Assert.AreEqual(1, gridIdentifer1.GridID); //Should be still 1 if the data is existing. IGridCoordinate gridCoordinate2 = new GridCoordinate { MaxXCoordinate = 5, MaxYCoordinate = 3 }; IGridIdentifer gridIdentifer2 = dataService.GetGridIdentifer(gridCoordinate2); Assert.AreEqual(1, gridIdentifer2.GridID); IGridCoordinate gridCoordinate3 = new GridCoordinate { MaxXCoordinate = 5, MaxYCoordinate = 5 }; IGridIdentifer gridIdentifer3 = dataService.GetGridIdentifer(gridCoordinate3); Assert.AreEqual(2, gridIdentifer3.GridID); }