public void ShouldThrowExistingPeerAddressExceptionOnDuplicatePeerAddress() { using (var http = new HttpTest()) { http.RespondWithJson(HttpStatusCode.Conflict, Fixtures.CreateErrorMessage(Constants.Etcd.ErrorCode_ExistingPeerAddress)); Func <Task> action = async() => { await Etcd.ClientFor(Fixtures.EtcdUrl.ToUri()) .Cluster .CreateMember() .WithPeerUri(Fixtures.EtcdUrl.ToUri()); }; action.ShouldThrowExactly <ExistingPeerAddressException>() .And .IsExistingPeerAddress.Should().BeTrue(); } }
private static HttpTest NewErrorCodeFixture(int?etcdErrorCode = null, HttpStatusCode status = HttpStatusCode.BadRequest) { return(new HttpTest() .RespondWithJson(status, Fixtures.CreateErrorMessage(etcdErrorCode))); }