public void TestUpdateAsync_ValidSurveyResponseCode_ReturnsModifiedResponseCode()
{
// Arrange
const string surveyId = "surveyId";
const int code = 10;
var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
var responseCodeToUpdate = new SurveyResponseCode
{
ResponseCode = code,
Description = "Description",
IsDefinite = true,
AllowAppointment = false
};
mockedHttpClient.Setup(client => client.PatchAsJsonAsync(It.IsAny<string>(), It.IsAny<UpdateSurveyResponseCode>()))
.Returns(CreateTask(HttpStatusCode.OK,
new StringContent(JsonConvert.SerializeObject(responseCodeToUpdate))));
var target = new NfieldSurveyResponseCodesService();
target.InitializeNfieldConnection(mockedNfieldConnection.Object);
// Act
var result = target.UpdateAsync(surveyId, responseCodeToUpdate).Result;
// Assert
Assert.Equal(responseCodeToUpdate.ResponseCode, result.ResponseCode);
Assert.Equal(responseCodeToUpdate.Description, result.Description);
Assert.Equal(responseCodeToUpdate.IsDefinite, result.IsDefinite);
Assert.Equal(responseCodeToUpdate.AllowAppointment, result.AllowAppointment);
Assert.Equal(responseCodeToUpdate.IsSelectable, result.IsSelectable);
}