コード例 #1
0
        public void TestRemoveAsync_ServerRemovedExternalApi_DoesNotThrow()
        {
            const string ExternalApiName = "ApiToDelete";
            var          externalApi     = new ExternalApi {
                Name = ExternalApiName
            };
            var mockedNfieldConnection = new Mock <INfieldConnectionClient>();
            var mockedHttpClient       = CreateHttpClientMock(mockedNfieldConnection);

            mockedHttpClient
            .Setup(client => client.DeleteAsync(new Uri(ServiceAddress, "externalapis/" + ExternalApiName)))
            .Returns(CreateTask(HttpStatusCode.OK));

            var target = new NfieldExternalApisService();

            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            // assert: no throw
            target.RemoveAsync(externalApi).Wait();
        }
コード例 #2
0
        public void TestRemoveAsync_ExternalApiIsNull_ThrowsArgumentNullException()
        {
            var target = new NfieldExternalApisService();

            Assert.Throws <ArgumentNullException>(() => UnwrapAggregateException(target.RemoveAsync(null)));
        }