Nfield.Services.Implementation.NfieldSurveyRelocationsService.InitializeNfieldConnection C# (CSharp) 메소드

InitializeNfieldConnection() 공개 메소드

public InitializeNfieldConnection ( INfieldConnectionClient connection ) : void
connection INfieldConnectionClient
리턴 void
        public void InitializeNfieldConnection(INfieldConnectionClient connection)
        {
            ConnectionClient = connection;
        }

Usage Example

        public void TestPutAsync_Always_CallsCorrectURI()
        {
            var relocation = new SurveyRelocation { Reason = "reason X", Url = "url X" };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(client => client.PutAsJsonAsync(It.IsAny<string>(), It.IsAny<SurveyRelocation>()))
                .Returns(CreateTask(HttpStatusCode.OK,
                    new StringContent(JsonConvert.SerializeObject(It.IsAny<SurveyRelocation>()))));

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

            target.UpdateAsync(SurveyId, relocation).Wait();

            mockedHttpClient
                .Verify(
                    client =>
                        client.PutAsJsonAsync(ServiceAddress + "Surveys/" + SurveyId + "/Relocations", It.IsAny<SurveyRelocation>()),
                    Times.Once());
        }
All Usage Examples Of Nfield.Services.Implementation.NfieldSurveyRelocationsService::InitializeNfieldConnection