コード例 #1
0
        public void TestRemoveAsync_ServerRemovedTranslation_DoesNotThrow()
        {
            var translation = new Translation {
                Name = "X", Text = "Translation X"
            };
            var mockedNfieldConnection = new Mock <INfieldConnectionClient>();
            var mockedHttpClient       = CreateHttpClientMock(mockedNfieldConnection);

            mockedHttpClient
            .Setup(client => client.DeleteAsync(ServiceAddress + "Surveys/" + SurveyId + "/Languages/10/Translations/X"))
            .Returns(CreateTask(HttpStatusCode.OK));

            var target = new NfieldTranslationsService();

            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            Assert.DoesNotThrow(() => target.RemoveAsync(SurveyId, LanguageId, translation).Wait());
        }
コード例 #2
0
        public void TestRemoveAsync_TranslationIsNull_ThrowsArgumentNullException()
        {
            var target = new NfieldTranslationsService();

            Assert.Throws <ArgumentNullException>(() => UnwrapAggregateException(target.RemoveAsync(SurveyId, LanguageId, null)));
        }
コード例 #3
0
        public void TestRemoveAsync_SurveyIdIsEmpty_Throws()
        {
            var target = new NfieldTranslationsService();

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