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

TestUploadInterviewerInstructionsAsync_FileExists_FileUpload() private method

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

            const string fileName = "asp.net-web-api-poster.pdf";
            var file = Path.Combine(Directory.GetCurrentDirectory(), "Resources", fileName);

            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(file, surveyId);

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