Nfield.Services.NfieldSurveysServiceTests.TestUploadInterviewerInstructionsAsync_ValidByteArray_FileUpload C# (CSharp) Method

TestUploadInterviewerInstructionsAsync_ValidByteArray_FileUpload() private method

        public void TestUploadInterviewerInstructionsAsync_ValidByteArray_FileUpload()
        {
            const string surveyId = "SurveyId";

            const string fileName = "instructions.pdf";

            var fileContent = Encoding.Unicode.GetBytes("Interviewer Instructions");

            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient.Setup(client => client.PostAsync(It.IsAny<string>(), It.IsAny<HttpContent>()))
                .Returns(CreateTask(HttpStatusCode.OK));

            var target = new NfieldSurveysService();
            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            target.UploadInterviewerFileInstructionsAsync(fileContent, fileName, surveyId);

            mockedHttpClient.Verify(
                hc => hc.PostAsync(It.Is<string>(uri => uri.Contains(fileName) && uri.Contains(surveyId)),
                    It.IsAny<HttpContent>()), Times.Once());
        }
NfieldSurveysServiceTests