public async Task PostCubes3DIntersectionShouldOverlap() { // Arrange var cubes3DIntersectionApiController = CreateCubes3DIntersectionApiController(); var firstCube3D = new Cube3DModel { PointCoordinates = PointModelFactory.Create(2, 2, 2) }; var secondCube3D = new Cube3DModel { PointCoordinates = PointModelFactory.Create(3, 2, 2) }; var edgesLength = 2; var cube3DIntersectionRequest = new Cube3DIntersectionModel { FirstCube3D = firstCube3D, SecondCube3D = secondCube3D, EdgesLength = edgesLength }; var cube3DIntersectionExpectedResponse = new Cube3DIntersectionModel { FirstCube3D = firstCube3D, SecondCube3D = secondCube3D, EdgesLength = edgesLength, Collision = true, IntersectionVolume = 4 }; _mockCube3DIntersectionService .Setup(ci => ci.Create(cube3DIntersectionRequest)) .ReturnsAsync(cube3DIntersectionExpectedResponse); // Act var createdResponse = await cubes3DIntersectionApiController.PostCubes3DIntersection( cube3DIntersectionRequest); Assert.NotNull(createdResponse); var result = createdResponse.Result as ObjectResult; Assert.Equal(result?.StatusCode, (int)HttpStatusCode.Created); var actualResult = result?.Value as Cube3DIntersectionModel; Assert.IsType <Cube3DIntersectionModel>(actualResult); Assert.True(actualResult.Collision == cube3DIntersectionExpectedResponse.Collision); Assert.True(actualResult.IntersectionVolume.Equals(cube3DIntersectionExpectedResponse.IntersectionVolume)); _mockCube3DIntersectionService.VerifyAll(); }
private void MakeCube3DIntersectionRequest( out Cubes3DIntersectionApiController cubes3DIntersectionApiController, out Cube3DModel firstCube3D, out Cube3DModel secondCube3D, out int edgesLength, out Cube3DIntersectionModel cube3DIntersectionRequest) { cubes3DIntersectionApiController = CreateCubes3DIntersectionApiController(); firstCube3D = new Cube3DModel { PointCoordinates = PointModelFactory.Create(2, 2, 2) }; secondCube3D = new Cube3DModel { PointCoordinates = PointModelFactory.Create(4, 2, 2) }; edgesLength = 2; cube3DIntersectionRequest = new Cube3DIntersectionModel { FirstCube3D = firstCube3D, SecondCube3D = secondCube3D, EdgesLength = edgesLength }; }