Nfield.Services.Implementation.NfieldSurveySettingsService.InitializeNfieldConnection C# (CSharp) Method

InitializeNfieldConnection() public method

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

Usage Example

        public void TestAddOrUpdateAsync_ServerAcceptsSetting_ReturnsSetting()
        {
            var setting = new SurveySetting { Name = "Setting X" };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            var content = new StringContent(JsonConvert.SerializeObject(setting));
            mockedHttpClient
                .Setup(client => client.PostAsJsonAsync(ServiceAddress + "Surveys/" + SurveyId + "/Settings", setting))
                .Returns(CreateTask(HttpStatusCode.OK, content));

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

            var actual = target.AddOrUpdateAsync(SurveyId, setting).Result;

            Assert.Equal(setting.Name, actual.Name);
        }
All Usage Examples Of Nfield.Services.Implementation.NfieldSurveySettingsService::InitializeNfieldConnection