コード例 #1
0
        public void ConsumerDeviceSimulatorTestMethod()
        {
            UInt32 DataSetGuid                = UInt32.MaxValue;
            MyMessageHandlerFactory _mhf      = new MyMessageHandlerFactory(DataSetGuid);
            ConsumerDeviceSimulator _consumer = ConsumerDeviceSimulator.CreateDevice(_mhf, DataSetGuid);

            Assert.IsNull(_consumer.AssociationsCollection);
            Assert.IsNotNull(_consumer.BindingFactory);
            Assert.IsNotNull(_consumer.ConfigurationFactory);
            Assert.IsNotNull(_consumer.EncodingFactory);
            Assert.IsNotNull(_consumer.MessageHandlerFactory);
            Assert.IsNull(_consumer.MessageHandlersCollection);
            _consumer.InitializeAndRun();
            Assert.AreEqual <int>(1, _consumer.AssociationsCollection.Count);
            Assert.AreEqual <int>(1, _consumer.MessageHandlersCollection.Count);
            ((ConsumerDeviceSimulator)_consumer).CheckConsistency();
            _mhf.CheckConsistency();
            _mhf.SendData();
        }
コード例 #2
0
        public void ConsumerDeviceSimulatorTestMethod()
        {
            uint DataSetGuid = uint.MaxValue;
            MessageHandlerFactoryTest _mhf = new MessageHandlerFactoryTest();

            using (ConsumerDeviceSimulator _consumer = ConsumerDeviceSimulator.CreateDevice(_mhf, DataSetGuid))
            {
                Assert.IsNull(_consumer.AssociationsCollection);
                Assert.IsNotNull(_consumer.BindingFactory);
                Assert.IsNotNull(_consumer.ConfigurationFactory);
                Assert.IsNotNull(_consumer.EncodingFactory);
                Assert.IsNotNull(_consumer.MessageHandlerFactory);
                Assert.IsNull(_consumer.MessageHandlersCollection);
                _consumer.InitializeAndRun();
                Assert.AreEqual <int>(1, _consumer.AssociationsCollection.Count);
                Assert.AreEqual <int>(1, _consumer.MessageHandlersCollection.Count);
                _consumer.CheckConsistency();
            }
            _mhf.AssertConsistency();
        }