Exemplo n.º 1
0
 public TestServer(string service, DdeContext context)
     : base(service, context)
 {
     _Timer.Elapsed += new ElapsedEventHandler(this.OnTimerElapsed);
     _Timer.Interval = 1000;
     _Timer.SynchronizingObject = base.Context;
 }
Exemplo n.º 2
0
 public void Test_Ctor_Overload_2()
 {
     using (DdeContext context = new DdeContext())
     {
         DdeServer server = new TestServer(ServiceName);
     }
 }
Exemplo n.º 3
0
 public void Test_Initialize()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Initialize();
     }
 }
Exemplo n.º 4
0
 public void Test_Initialize_After_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Dispose();
         context.Initialize();
     }
 }
Exemplo n.º 5
0
 public void Test_AddTransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         IDdeTransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
     }
 }
Exemplo n.º 6
0
 internal static DdeContext GetDefault()
     {
         lock (_InstanceLock)
             {
                 if (_Instance == null)
                     _Instance = new DdeContext();
                 return _Instance;
             }
     }
Exemplo n.º 7
0
 internal static DdeContext GetDefault(ISynchronizeInvoke synchronizingObject)
     {
         if (synchronizingObject != null)
             lock (_Instances)
                 {
                     var context = _Instances[synchronizingObject];
                     if (context == null)
                         {
                             if (synchronizingObject is DdeContext)
                                 context = synchronizingObject as DdeContext;
                             else
                                 context = new DdeContext(synchronizingObject);
                             _Instances.Add(synchronizingObject, context);
                         }
                     return context;
                 }
         return GetDefault();
     }
Exemplo n.º 8
0
 internal static DdeContext GetDefault(ISynchronizeInvoke synchronizingObject)
 {
     if (synchronizingObject != null)
     {
         lock (_Instances)
         {
             DdeContext context = _Instances[synchronizingObject];
             if (context == null)
             {
                 if (synchronizingObject is DdeContext)
                 {
                     context = synchronizingObject as DdeContext;
                 }
                 else
                 {
                     context = new DdeContext(synchronizingObject);
                 }
                 _Instances.Add(synchronizingObject, context);
             }
             return context;
         }
     }
     return GetDefault();
 }
Exemplo n.º 9
0
 internal static DdeContext GetDefault()
 {
     lock (_InstanceLock)
     {
         if (_Instance == null)
         {
             _Instance = new DdeContext();
         }
         return _Instance;
     }
 }
Exemplo n.º 10
0
 public void Test_IsInitialized_Variation_1()
 {
     using (DdeContext context = new DdeContext())
     {
         Assert.IsFalse(context.IsInitialized);
     }
 }
Exemplo n.º 11
0
 public AsyncResult(DdeContext context)
 {
     _Context = context;
 }
Exemplo n.º 12
0
 public void Test_Unregister()
 {
     using (DdeContext context = new DdeContext())
     {
         EventListener listener = new EventListener();
         context.Unregister += listener.OnEvent;
         context.Initialize();
         using (DdeServer server = new TestServer(ServiceName))
         {
             server.Register();
             server.Unregister();
         }
         Assert.IsTrue(listener.Received.WaitOne(Timeout, false));
     }
 }
Exemplo n.º 13
0
 public void Test_TransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         TransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
         context.Initialize();
         using (DdeServer server = new TestServer(ServiceName))
         {
             server.Register();
         }
         Assert.IsTrue(filter.Received.WaitOne(Timeout, false));
     }
 }
Exemplo n.º 14
0
 public void Test_RemoveTransactionFilter_After_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
         TransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
         context.Dispose();
         context.RemoveTransactionFilter(filter);
     }
 }
Exemplo n.º 15
0
 public void Test_IsInitialized_Variation_2()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Initialize();
         Assert.IsTrue(context.IsInitialized);
     }
 }
Exemplo n.º 16
0
 public TracingServer(string service, DdeContext context)
     : base(service, context)
 {
 }
Exemplo n.º 17
0
 public void Test_Ctor_Overload_2()
 {
     using (DdeContext context = new DdeContext())
     {
         DdeClient client = new DdeClient(ServiceName, TopicName, context);
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// This initializes a new instance of the <c>DdeServer</c> class that can register the specified service name and uses the specified
 /// context.
 /// </summary>
 /// <param name="service">
 /// The service name that this instance can register.
 /// </param>
 /// <param name="context">
 /// The context to use for execution.
 /// </param>
 /// <exception cref="ArgumentException">
 /// This is thown when service exceeds 255 characters..
 /// </exception>
 /// <exception cref="ArgumentNullException">
 /// This is thrown when service is a null reference.
 /// </exception>
 public DdeServer(string service, DdeContext context)
 {
     Service = service;
     Context = context;
 }
Exemplo n.º 19
0
 public void Test_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
     }
 }
Exemplo n.º 20
0
 public void Test_Ctor_Overload_2()
 {
     DdeContext context = new DdeContext(new DdeContext());
 }
Exemplo n.º 21
0
 /// <summary>
 /// This initializes a new instance of the <c>DdeClient</c> class that can connect to a server that supports the specified service name and
 /// topic name pair and uses the specified context.
 /// </summary>
 /// <param name="service">
 /// A service name supported by a server application.
 /// </param>
 /// <param name="topic">
 /// A topic name support by a server application.
 /// </param>
 /// <param name="context">
 /// The context to use for execution.
 /// </param>
 /// <exception cref="ArgumentException">
 /// This is thown when servic or topic exceeds 255 characters.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 /// This is thrown when service or topic is a null reference.
 /// </exception>
 public DdeClient(string service, string topic, DdeContext context)
 {
     Service = service;
     Topic = topic;
     Context = context;
 }