예제 #1
0
 // constructors
 /// <summary>
 /// Construct a new FailPoing with a specified name and custom arguments.
 /// </summary>
 /// <param name="server">The server.</param>
 /// <param name="binding">Must be a single server binding.</param>
 /// <param name="command">The command.</param>
 public FailPoint(IServer server, IReadWriteBinding binding, BsonDocument command)
 {
     _server  = Ensure.IsNotNull(server, nameof(server));
     _binding = Ensure.IsNotNull(binding, nameof(binding));
     _command = Ensure.IsNotNull(command, nameof(command));
     Ensure.That(command.GetElement(0).Name == "configureFailPoint", "Command name must be \"configureFailPoint\".", nameof(command));
 }
예제 #2
0
 // constructors
 /// <summary>
 /// Construct a new FailPoing with a specified name and custom arguments.
 /// </summary>
 /// <param name="server">The server.</param>
 /// <param name="binding">Must be a single server binding.</param>
 /// <param name="name">The name.</param>
 /// <param name="args">The arguments for the FailPoint.</param>
 public FailPoint(IServer server, IReadWriteBinding binding, string name, BsonDocument args)
 {
     _server  = Ensure.IsNotNull(server, nameof(server));
     _binding = Ensure.IsNotNull(binding, nameof(binding));
     _name    = Ensure.IsNotNull(name, nameof(name));
     _args    = Ensure.IsNotNull(args, nameof(args));
 }
예제 #3
0
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation, IReadWriteBinding binding, bool async)
 {
     if (async)
     {
         return(operation.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult());
     }
     else
     {
         return(operation.Execute(binding, CancellationToken.None));
     }
 }
예제 #4
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="ReadWriteBindingHandle"/> class.
 /// </summary>
 /// <param name="writeBinding">The write binding.</param>
 public ReadWriteBindingHandle(IReadWriteBinding writeBinding)
     : this(new ReferenceCounted <IReadWriteBinding>(writeBinding))
 {
 }
 public void Setup()
 {
     _readWriteBinding = Substitute.For <IReadWriteBinding>();
 }
 // constructors
 public ReadWriteBindingHandle(IReadWriteBinding writeBinding)
     : this(new ReferenceCounted<IReadWriteBinding>(writeBinding))
 {
 }
 public void Setup()
 {
     _readWriteBinding = Substitute.For<IReadWriteBinding>();
 }