Skip to content

Commit

Permalink
Add test for create robot model endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aeshub committed Feb 13, 2025
1 parent 2baf745 commit bd97660
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/api.test/Controllers/RobotModelControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ public async Task CheckThatLookupRobotModelByIdReturnsSuccess()
Assert.Equal(robotModel.Type, robotModelFromResponse!.Type);
}

[Fact]
public async Task CheckThatCreateRobotModelReturnsSuccess()
{
// Arrange
var modelBefore = await RobotModelService.ReadByRobotType(RobotType.Robot);
_ = await RobotModelService.Delete(modelBefore!.Id);

var query = new CreateRobotModelQuery { RobotType = RobotType.Robot };
var content = new StringContent(JsonSerializer.Serialize(query), null, "application/json");

// Act
var response = await Client.PostAsync("/robot-models", content);

// Assert
var modelAfter = await RobotModelService.ReadByRobotType(RobotType.Robot);

Assert.True(response.IsSuccessStatusCode);
Assert.NotEqual(modelBefore!.Id, modelAfter!.Id);
}

[Theory]
[InlineData(10, 90, 10, 50, true)]
[InlineData(-1, -10, 10, 50, false)]
Expand Down

0 comments on commit bd97660

Please sign in to comment.