Пример #1
0
 /// <summary>
 ///   Constructor for a Broker that receives a reference to a broker, module and a nativeWrapper. NativeWrapper is used for Unit Tests.
 /// </summary>
 /// <param name="broker">A reference to an existing broker.</param>
 /// <param name="module">A reference to an existing module.</param>
 /// <param name="nativeWrapper">A Native DotNet Host Wrapper used for Mocking purposes on Unit Tests.</param>
 public Broker(long broker, long module, NativeDotNetHostWrapper nativeWrapper)
 {
     /* Codes_SRS_DOTNET_BROKER_04_001: [ If broker is <= 0, Broker constructor shall throw a new ArgumentException ] */
     if (broker <= 0)
     {
         throw new ArgumentOutOfRangeException("Invalid broker");
     }
     /* Codes_SRS_DOTNET_BROKER_04_007: [ If module is <= 0, Broker constructor shall throw a new ArgumentException ] */
     else if (module <= 0)
     {
         throw new ArgumentOutOfRangeException("Invalid source module");
     }
     else
     {
         /* Codes_SRS_DOTNET_BROKER_04_002: [ If broker and module are greater than 0, Broker constructor shall save this value and succeed. ] */
         this.brokerHandle  = broker;
         this.moduleHandle  = module;
         this.dotnetWrapper = nativeWrapper;
     }
 }
 public MessageBus(long msgBus, long module, NativeDotNetHostWrapper nativeWrapper)
 {
     /* Codes_SRS_DOTNET_MESSAGEBUS_04_001: [ If msgBus is <= 0, MessageBus constructor shall throw a new ArgumentException ] */
     if (msgBus <= 0)
     {
         throw new ArgumentOutOfRangeException("Invalid Msg Bus.");
     }
     /* Codes_SRS_DOTNET_MESSAGEBUS_04_007: [ If moduleHandle is <= 0, MessageBus constructor shall throw a new ArgumentException ] */
     else if (module <= 0)
     {
         throw new ArgumentOutOfRangeException("Invalid source Module Handle.");
     }
     else
     {
         /* Codes_SRS_DOTNET_MESSAGEBUS_04_002: [ If msgBus and moduleHandle is greater than 0, MessageBus constructor shall save this value and succeed. ] */
         this.msgBusHandle  = msgBus;
         this.moduleHandle  = module;
         this.dotnetWrapper = nativeWrapper;
     }
 }