Ejemplo n.º 1
0
 public void Test_Initialize()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Initialize();
     }
 }
Ejemplo n.º 2
0
 public void Test_Ctor_Overload_2()
 {
     using (DdeContext context = new DdeContext())
     {
         DdeClient client = new DdeClient(ServiceName, TopicName, context);
     }
 }
Ejemplo n.º 3
0
 public void Test_Ctor_Overload_2()
 {
     using (DdeContext context = new DdeContext())
     {
         DdeServer server = new TestServer(ServiceName);
     }
 }
Ejemplo n.º 4
0
 public void Test_IsInitialized_Variation_1()
 {
     using (DdeContext context = new DdeContext())
     {
         Assert.IsFalse(context.IsInitialized);
     }
 }
Ejemplo n.º 5
0
 public TestServer(string service, DdeContext context)
     : base(service, context)
 {
     _Timer.Elapsed += new ElapsedEventHandler(this.OnTimerElapsed);
     _Timer.Interval = 1000;
     _Timer.SynchronizingObject = base.Context;
 }
Ejemplo n.º 6
0
 public void Test_IsInitialized_Variation_2()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Initialize();
         Assert.IsTrue(context.IsInitialized);
     }
 }
Ejemplo n.º 7
0
 public void Test_Initialize_After_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
         context.Dispose();
         context.Initialize();
     }
 }
Ejemplo n.º 8
0
 internal static DdeContext GetDefault()
 {
     lock (_InstanceLock)
     {
         if (_Instance == null)
         {
             _Instance = new DdeContext();
         }
         return _Instance;
     }
 }
Ejemplo n.º 9
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();
 }
Ejemplo n.º 10
0
 public void Test_AddTransactionFilter_After_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
         IDdeTransactionFilter filter = new TransactionFilter();
         context.Dispose();
         context.AddTransactionFilter(filter);
     }
 }
Ejemplo n.º 11
0
 public AsyncResult(DdeContext context)
 {
     _Context = context;
 }
Ejemplo n.º 12
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();
 }
Ejemplo n.º 13
0
 public void Test_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
     }
 }
Ejemplo n.º 14
0
 public void Test_Ctor_Overload_2()
 {
     DdeContext context = new DdeContext(new DdeContext());
 }
Ejemplo n.º 15
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));
     }
 }
Ejemplo n.º 16
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));
     }
 }
Ejemplo n.º 17
0
 public void Test_RemoveTransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         TransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
         context.RemoveTransactionFilter(filter);
     }
 }
Ejemplo n.º 18
0
 internal static DdeContext GetDefault()
 {
     lock (_InstanceLock)
     {
         if (_Instance == null)
         {
             _Instance = new DdeContext();
         }
         return _Instance;
     }
 }
Ejemplo n.º 19
0
 public TracingServer(string service, DdeContext context)
     : base(service, context)
 {
 }
Ejemplo n.º 20
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;
 }
Ejemplo 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;
 }