public void TestUpdateAsync_TranslationExists_DoesNotThrow()
        {
            var translation = new Translation
            {
                Name = "X",
                Text = "Translation X"
            };
            var mockedNfieldConnection = new Mock <INfieldConnectionClient>();
            var mockedHttpClient       = CreateHttpClientMock(mockedNfieldConnection);

            mockedHttpClient
            .Setup(client => client.PutAsJsonAsync(
                       ServiceAddress + "Surveys/" + SurveyId + "/Languages/10/Translations", It.IsAny <Translation>()))
            .Returns(CreateTask(HttpStatusCode.OK));

            var target = new NfieldTranslationsService();

            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            Assert.DoesNotThrow(() => target.UpdateAsync(SurveyId, LanguageId, translation).Wait());
        }
Example #2
0
        public void TestUpdateAsync_TranslationIsNull_ThrowsArgumentNullException()
        {
            var target = new NfieldTranslationsService();

            Assert.Throws <ArgumentNullException>(() => UnwrapAggregateException(target.UpdateAsync(SurveyId, LanguageId, null)));
        }
Example #3
0
        public void TestUpdateAsync_SurveyIdIsEmpty_Throws()
        {
            var target = new NfieldTranslationsService();

            Assert.Throws <ArgumentException>(() => UnwrapAggregateException(target.UpdateAsync("", 0, new Translation())));
        }