Beispiel #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="view">View.</param>
        public TestController(ITestView view)
            : base(view)
        {
            _profilesSupportInfo = new Dictionary <IProfileDefinition, ProfileTestInfo>();
            _testResults         = new Dictionary <TestInfo, TestResult>();

            _td = new TestDispatcher();

            _td.NetworkSettingsChangedEvent += _td_NetworkSettingsChanged;

            _td.TestStarted   += _td_TestStarted;
            _td.TestCompleted += _td_TestCompleted;

            _td.StepStarted   += _td_StepStarted;
            _td.StepCompleted += _td_StepCompleted;

            _td.RequestSent      += _td_RequestSent;
            _td.ResponseReceived += _td_ResponseReceived;

            _td.OnException                += _td_OnException;
            _td.StepEvent                  += _td_StepEvent;
            _td.TestEvent                  += _td_TestEvent;
            _td.Paused                     += _td_Paused;
            _td.FeatureDefined             += _td_FeatureDefined;
            _td.FeatureDefinitionFailed    += _td_FeatureDefinitionFailed;
            _td.InitializationCompleted    += _td_InitializationCompleted;
            _td.DeviceInformationReceived  += _td_DeviceInformationReceived;
            _td.ProfileDefinitionCompleted += _td_ProfileDefinitionCompleted;
            _td.TestSuiteCompleted         += _td_TestSuiteCompleted;
        }
Beispiel #2
0
        public TestController(ITestView view)
        {
            _view = view;

            _td = new TestDispatcher();

            _td.TestStarted   += _td_TestStarted;
            _td.TestCompleted += _td_TestCompleted;

            _td.StepStarted   += _td_StepStarted;
            _td.StepCompleted += _td_StepCompleted;

            _td.RequestSent      += _td_RequestSent;
            _td.ResponseReceived += _td_ResponseReceived;

            _td.OnException += _td_OnException;
            _td.StepEvent   += _td_StepEvent;
            _td.TestEvent   += _td_TestEvent;

            _td.TestSuiteCompleted += new Action <TestSuiteParameters, bool>(_td_TestSuiteCompleted);

            string address = System.Configuration.ConfigurationManager.AppSettings["DutManagementAddress"];

            System.ServiceModel.BasicHttpBinding binding         = new System.ServiceModel.BasicHttpBinding();
            System.ServiceModel.EndpointAddress  endpointAddress = new System.ServiceModel.EndpointAddress(address);
            _dutClient = new AutomatedTesting.DutManagement.DutManagementService.TestSoapClient(binding, endpointAddress);
        }
Beispiel #3
0
        private void btnDiscoveryTest_Click(object sender, EventArgs e)
        {
            listViewTrace.Items.Clear();
            richTextBoxStepRequest.Text = string.Empty;
            richTextBoxStepAnswer.Text = string.Empty;
            richTextBoxException.Text = string.Empty;
            
            btnDiscoveryTest.Enabled = false;
            btnStop.Enabled = true;
            btnPause.Enabled = true;
            btnHalt.Enabled = true;
            _testIsRunning = true;

            TestSuiteParameters parameters = new TestSuiteParameters();
            foreach (TestInfo ti in _selectedTests)
            {
                parameters.TestCases.Add(ti.Method);
            }
            parameters.Address = tbAddress.Text;


            try
            {
                _td = new TestDispatcher();
                _td.OnException += new Action<Exception>(_tr_OnException);
                _td.OnStepCompleted += ts_OnStepCompleted;
                _td.OnTestSuiteCompleted += new Action(_tr_OnTestSuiteCompleted);
                _td.Run(parameters);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
        public void ClearItemsUsesDispatcherToRaiseEvents()
        {
            var collection = new BindableCollection <Element>()
            {
                new Element()
            };

            bool propertyChangedRaised = false;

            ((INotifyPropertyChanged)collection).PropertyChanged += (o, e) => propertyChangedRaised = true;
            bool collectionChangingRaised = false;

            collection.CollectionChanging += (o, e) => collectionChangingRaised = true;
            bool collectionChangedRaised = false;

            collection.CollectionChanged += (o, e) => collectionChangedRaised = true;

            var dispatcher = new TestDispatcher();

            Execute.Dispatcher = dispatcher;

            collection.Clear();

            Assert.False(propertyChangedRaised);
            Assert.False(collectionChangingRaised);
            Assert.False(collectionChangedRaised);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.True(propertyChangedRaised);
            Assert.True(collectionChangingRaised);
            Assert.True(collectionChangedRaised);
        }
Beispiel #5
0
        public void PublishEventsToCertainQueueTestFourTimes()
        {
            var repoMock = new Mock <IRepository>(MockBehavior.Strict);
            var ev       = new SerializedEvent()
            {
                ID = 1337, TimeReceived = DateTime.Now, Body = "test body", EventType = typeof(TestEvent).FullName, RoutingKey = "#"
            };

            repoMock.Setup(repo => repo.FindBy(It.IsAny <Expression <Func <SerializedEvent, bool> > >())).Returns(() => new List <SerializedEvent>()
            {
                ev, ev, ev, ev
            });
            var queueName = "TestQueue2";

            using (var sender = new EventPublisher(_busOptions))
                using (var receiver = new TestDispatcher(_direct, queueName))
                    using (var publisher = new AuditPublisher(_direct))
                        using (var dispatcher = new AuditDispatcher(repoMock.Object, publisher, _busOptions))
                        {
                            var saec = new SendAllEventCommand();
                            saec.returnQueueName = queueName;
                            saec.StartTime       = DateTime.MinValue;
                            saec.EndTime         = DateTime.MaxValue;
                            sender.Publish(saec);

                            Thread.Sleep(1000);

                            Assert.AreEqual(4, receiver.ReceivedTestEventCount);
                        }
        }
Beispiel #6
0
        public async Task ManualDispatchTest()
        {
            var fixture = new Fixture().Customize(new AutoMoqCustomization {
                ConfigureMembers = true
            }).Customize(new SupportMutableValueTypesCustomization());
            var op         = fixture.Create <A>();
            var moqHandler = fixture.Freeze <Mock <IHandler <A, int, DefaultMessage> > >();
            var result     = fixture.Freeze <int>();
            var factory    = new Mock <IHandlerFactory>();

            factory.Setup(f => f.Create <A, int, DefaultMessage>(It.IsAny <RequestContext <DefaultMessage> >())).ReturnsUsingFixture(fixture);
            var model = new OperationRuntimeModel(new[]
            {
                new OperationDescription(0, typeof(A), typeof(int), Side.Server, DeliveryMode.Ordered, DeliveryMode.Ordered, true),
                new OperationDescription(1, typeof(B), typeof(float), Side.Server, DeliveryMode.Ordered, DeliveryMode.Ordered, true)
            });
            var dispatcher = new TestDispatcher(new MsgSerializer(), factory.Object, model, new NullLoggerFactory(), new DescriptionRuntimeModel());

            dispatcher.Subscribe(new Mock <IResponseReceiver <DefaultMessage> >().Object);
            var hasData     = true;
            var sessionMock = new Mock <Session>(Array.Empty <SessionProperty>());

            sessionMock.SetupGet(s => s.HasAvailableData).Returns(() => hasData);
            sessionMock.Setup(s => s.ReceiveMessageAsync()).ReturnsAsync(() =>
            {
                hasData = false;
                return(CreateRawMessage(0, op, TypeMessage.Request));
            });
            await dispatcher.DispatchAsync(sessionMock.Object);

            sessionMock.Verify(s => s.ReceiveMessageAsync(), Times.Once);
            moqHandler.Verify(handler => handler.Handle(op, It.IsAny <RequestContext <DefaultMessage> >(), It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #7
0
        public void Schedule_in_future_using_DateTimeOffset_invokes_Enqueue_in_background_on_threadpool()
        {
            var        dispatcher                = new TestDispatcher();
            bool       disposeCalled             = false;
            var        eventWaitHandle           = new ManualResetEvent(false);
            var        dueTime                   = DateTimeOffset.Now.AddMilliseconds(100);
            int?       statePassedToCallback     = null;
            IScheduler schedulerPassedToCallback = null;

            using (dispatcher.Schedule(1337, dueTime, (sched, state) =>
            {
                statePassedToCallback = state;
                schedulerPassedToCallback = sched;
                eventWaitHandle.Set();
                return(Disposable.Create(() => disposeCalled = true));
            }))
            {
                Assert.That(eventWaitHandle.WaitOne(1000), Is.True, "Timed out waiting for action to get invoked in background");
                Assert.That(disposeCalled, Is.False);
            }

            Assert.That(statePassedToCallback, Is.EqualTo(1337));
            Assert.That(schedulerPassedToCallback, Is.EqualTo(dispatcher));
            Assert.That(disposeCalled, Is.True);
        }
        static void Main(string[] args)
        {
            "Testing AbstractCommunicator".Title();

            TestCommunicator tc1 = new TestCommunicator();

            tc1.Name = "tc1";
            tc1.Start();

            TestCommunicator tc2 = new TestCommunicator();

            tc2.Name = "tc2";
            tc2.Start();

            TestDispatcher td = new TestDispatcher();

            td.Name    = "td";
            td.Verbose = true;
            td.Start();
            td.Register(tc1);

            // show that GetInstance works

            AbstractMessageDispatcher tdi = TestDispatcher.GetInstance();

            tdi.Register(tc2);

            ServiceMessage msg0 = ServiceMessage.MakeMessage("foobar", "Main", "going nowhere");

            td.PostMessage(msg0);
            ServiceMessage msg1 = ServiceMessage.MakeMessage(tc1.Name, "Main", "some boring contents");

            td.PostMessage(msg1);
            ServiceMessage msg2 = ServiceMessage.MakeMessage(tc2.Name, "Main", "more boring contents");

            td.PostMessage(msg2);
            ServiceMessage msg3 = ServiceMessage.MakeMessage(tc1.Name, "Main", "quit");

            td.PostMessage(msg3);
            ServiceMessage msg4 = ServiceMessage.MakeMessage(tc2.Name, "Main", "quit");

            td.PostMessage(msg4);
            ServiceMessage msg5 = ServiceMessage.MakeMessage(td.Name, "Main", "quit");

            td.PostMessage(msg5);

            tc1.Wait();
            tc2.Wait();
            td.Wait();

            Console.Write("\n\n");
        }
        public async Task Simple_test_sync()
        {
            TestSyncFeed   syncFeed     = new TestSyncFeed();
            TestDispatcher dispatcher   = new TestDispatcher(syncFeed, new TestSyncPeerPool(), new StaticPeerAllocationStrategyFactory <TestBatch>(FirstFree.Instance));
            Task           executorTask = dispatcher.Start(CancellationToken.None);

            syncFeed.Activate();
            await executorTask;

            for (int i = 0; i < TestSyncFeed.Max; i++)
            {
                syncFeed._results.Contains(i).Should().BeTrue(i.ToString());
            }
        }
        public void ShouldBeBusyWhenUsingBusyStack()
        {
            var dispatcher     = new TestDispatcher();
            var commandBuilder = new ScarletCommandBuilder(dispatcher, Utils.GetTestCommandManager(), Utils.GetTestExceptionHandler(), Utils.GetTestMessenger(), Utils.GetTestExitService(), Utils.GetTestEventManager(), (lambda) => new BusyStack(lambda));

            var vm = new DerivedViewModelListBase(commandBuilder);

            Assert.AreEqual(false, vm.IsBusy);
            vm.ValidateState(() =>
            {
                Assert.AreEqual(true, vm.IsBusy);
            });
            Assert.AreEqual(false, vm.IsBusy);
        }
Beispiel #11
0
        /// <summary>
        /// Subscribers to dispatcher's events.
        /// </summary>
        protected void InitTestEnvironment()
        {
            _td                     = new TestDispatcher();
            _td.TestStarted        += _td_TestStarted;
            _td.TestCompleted      += _td_TestCompleted;
            _td.TestSuiteCompleted += _td_TestSuiteCompleted;
            _td.StepStarted        += _td_StepStarted;
            _td.StepCompleted      += _td_StepCompleted;
            _td.RequestSent        += _td_RequestSent;
            _td.ResponseReceived   += _td_ResponseReceived;
            _td.OnException        += _td_OnException;
            _td.StepEvent          += _td_StepEvent;
            _td.TestEvent          += _td_TestEvent;

            _testResults = new Dictionary <TestInfo, TestResult>();
        }
Beispiel #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="view">View.</param>
 public TestController(ITestView view)
     : base(view)
 {
     _td                     = new TestDispatcher();
     _td.TestStarted        += _td_TestStarted;
     _td.TestCompleted      += _td_TestCompleted;
     _td.StepStarted        += _td_StepStarted;
     _td.StepCompleted      += _td_StepCompleted;
     _td.RequestSent        += _td_RequestSent;
     _td.ResponseReceived   += _td_ResponseReceived;
     _td.TestSuiteCompleted += _td_TestSuiteCompleted;
     _td.OnException        += _td_OnException;
     _td.StepEvent          += _td_StepEvent;
     _td.TestEvent          += _td_TestEvent;
     _td.Paused             += _td_Paused;
     _testResults            = new Dictionary <TestInfo, TestResult>();
 }
        public void InsertItemUsesDispatcherToInsertItem()
        {
            var collection = new BindableCollection <Element>();

            var dispatcher = new TestDispatcher();

            Execute.Dispatcher = dispatcher;

            collection.Add(new Element());

            Assert.AreEqual(0, collection.Count);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(1, collection.Count);
        }
Beispiel #14
0
        public void Schedule_with_state_and_action()
        {
            var  dispatcher    = new TestDispatcher();
            bool disposeCalled = false;

            using (dispatcher.Schedule(1337, (sched, state) =>
            {
                Assert.That(state, Is.EqualTo(1337));
                Assert.That(sched, Is.EqualTo(dispatcher));
                return(Disposable.Create(() => disposeCalled = true));
            }))
            {
                // Should be scheduled immediately
                Assert.That(disposeCalled, Is.False);
            }

            Assert.That(disposeCalled, Is.True);
        }
        public void RemoveRangeUsesDispatcherToRemoveElements()
        {
            var itemsToRemove = new[] { new Element(), new Element() };
            var existingItems = new[] { new Element() };
            var collection = new BindableCollection<Element>(itemsToRemove.Concat(existingItems));

            var dispatcher = new TestDispatcher();
            Execute.Dispatcher = dispatcher;

            collection.RemoveRange(itemsToRemove);

            Assert.That(collection, Is.EquivalentTo(itemsToRemove.Concat(existingItems)));
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(existingItems, collection);
        }
Beispiel #16
0
        public void Given_Props_When_WithDispatcher_Then_mutate_Dispatcher()
        {
            var dispatcher = new TestDispatcher();

            var props  = new Props();
            var props2 = props.WithDispatcher(dispatcher);

            Assert.NotEqual(props, props2);
            Assert.Equal(dispatcher, props2.Dispatcher);

            Assert.NotEqual(props.Dispatcher, props2.Dispatcher);
            Assert.Equal(props.MailboxProducer, props2.MailboxProducer);
            Assert.Equal(props.ReceiverMiddleware, props2.ReceiverMiddleware);
            Assert.Equal(props.ReceiverMiddlewareChain, props2.ReceiverMiddlewareChain);
            Assert.Equal(props.Producer, props2.Producer);
            Assert.Equal(props.Spawner, props2.Spawner);
            Assert.Equal(props.SupervisorStrategy, props2.SupervisorStrategy);
        }
        public void RemoveRangeUsesDispatcherToRemoveElements()
        {
            var itemsToRemove = new[] { new Element(), new Element() };
            var existingItems = new[] { new Element() };
            var collection    = new BindableCollection <Element>(itemsToRemove.Concat(existingItems));

            var dispatcher = new TestDispatcher();

            Execute.Dispatcher = dispatcher;

            collection.RemoveRange(itemsToRemove);

            Assert.That(collection, Is.EquivalentTo(itemsToRemove.Concat(existingItems)));
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(existingItems, collection);
        }
        public void AddCollectHandlerTest()
        {
            var dispatcher = new TestDispatcher();
            var listener   = new TestListener(dispatcher);

            Assert.False(listener.Validated);

            dispatcher.FireTestEvent();

            Assert.True(listener.Validated);

            listener = null;
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForFullGCComplete();

            Assert.DoesNotThrow(
                () => dispatcher.FireTestEvent()
                );
        }
        public void ClearItemsUsesDispatcherToClearItems()
        {
            var collection = new BindableCollection <Element>()
            {
                new Element()
            };

            var dispatcher = new TestDispatcher();

            Execute.Dispatcher = dispatcher;

            collection.Clear();

            Assert.AreEqual(1, collection.Count);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(0, collection.Count);
        }
Beispiel #20
0
        public void SettingValueOnFieldDispatchesCommand()
        {
            const string newTitle = "New Title";
            var          model    = new NodeModel {
                Title = ""
            };
            var commandDispatcher = new TestDispatcher();
            var field             = new ModelPropertyField <string>(commandDispatcher, model, nameof(NodeModel.Title), null, typeof(TestCommand));

            Window.rootVisualElement.Add(field);

            var inputField = field.SafeQ <BaseField <string> >(null, BaseField <string> .ussClassName);

            Assert.AreNotEqual(newTitle, model.Title);
            Assert.AreNotEqual(newTitle, inputField.value);
            Assert.AreNotEqual(typeof(TestCommand), TestDispatcher.LastDispatchedCommandType);

            inputField.value = newTitle;

            Assert.AreEqual(typeof(TestCommand), TestDispatcher.LastDispatchedCommandType);
        }
        public void SetItemUsesDispatcherToSetItems()
        {
            var initialElement = new Element();
            var collection     = new BindableCollection <Element>()
            {
                initialElement
            };
            var element = new Element();

            var dispatcher = new TestDispatcher();

            Execute.Dispatcher = dispatcher;

            collection[0] = element;

            Assert.AreEqual(initialElement, collection[0]);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(element, collection[0]);
        }
Beispiel #22
0
        // TODO: use the load task
        internal static (MockStorageMod, StorageMod, TestDispatcher) CreateStorageMod(UpdateTarget?stateTarget = null)
        {
            var mockStorage = new MockStorageMod();

            for (int i = 0; i < 3; i++)
            {
                mockStorage.SetFile($"/addons/asdf_{i}.pbo", "qwe");
            }

            var state = new Mock <IPersistedStorageModState>(MockBehavior.Strict);

            state.SetupProperty(x => x.UpdateTarget, stateTarget);

            var eventBus        = new TestDispatcher();
            var serviceProvider = new ServiceProvider();

            serviceProvider.Add <IDispatcher>(eventBus);
            var storageMod = new StorageMod(mockStorage, "mystorage", state.Object, null !, true, serviceProvider);


            return(mockStorage, storageMod, eventBus);
        }
Beispiel #23
0
        public void basic_constructor_no_valid_mode()
        {
            const int mode                 = 1;
            var       deviceId             = Guid.NewGuid();
            var       activationButtonList = new Dictionary <int, ModeActivationItem>
            {
                { 1, new ModeActivationItem()
                  {
                      ButtonId = 1, ButtonName = "test button", ProfileName = "select combat mode", IsShift = true, DeviceId = deviceId
                  } }
            };

            var dispatcher = new TestDispatcher();


            var profileVm = new ModeProfileConfigWindowViewModel(Substitute.For <IEventAggregator>(), dispatcher, mode, activationButtonList);


            Assert.Equal(2, profileVm.TemplateModes.Count);
            Assert.False(profileVm.IsTemplateModeVisible);
            Assert.Equal("select combat mode", profileVm.ProfileName);
            Assert.Equal("test button", profileVm.ActivationButtonName);
            Assert.True(profileVm.IsShift);
        }
        public void InsertItemUsesDispatcherToInsertItem()
        {
            var collection = new BindableCollection<Element>();

            var dispatcher = new TestDispatcher();
            Execute.Dispatcher = dispatcher;

            collection.Add(new Element());

            Assert.AreEqual(0, collection.Count);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(1, collection.Count);
        }
        public void ClearItemsUsesDispatcherToClearItems()
        {
            var collection = new BindableCollection<Element>() { new Element() };

            var dispatcher = new TestDispatcher();
            Execute.Dispatcher = dispatcher;

            collection.Clear();

            Assert.AreEqual(1, collection.Count);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(0, collection.Count);
        }
        public void ClearItemsUsesDispatcherToRaiseEvents()
        {
            var collection = new BindableCollection<Element>() { new Element() };

            bool propertyChangedRaised = false;
            ((INotifyPropertyChanged)collection).PropertyChanged += (o, e) => propertyChangedRaised = true;
            bool collectionChangingRaised = false;
            collection.CollectionChanging += (o, e) => collectionChangingRaised = true;
            bool collectionChangedRaised = false;
            collection.CollectionChanged += (o, e) => collectionChangedRaised = true;

            var dispatcher = new TestDispatcher();
            Execute.Dispatcher = dispatcher;

            collection.Clear();

            Assert.False(propertyChangedRaised);
            Assert.False(collectionChangingRaised);
            Assert.False(collectionChangedRaised);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.True(propertyChangedRaised);
            Assert.True(collectionChangingRaised);
            Assert.True(collectionChangedRaised);
        }
 public TestListener(TestDispatcher dispatcher)
 {
     dispatcher.TestEvent += OnTestEvent;
 }
 public void SetUp()
 {
     initialState = new RootState();
     reducer      = Substitute.For <IReduxReducer <RootState> >();
     dispatcher   = new TestDispatcher(initialState, reducer, TaskScheduler.Current);
 }
Beispiel #29
0
 public CommonDispatcherTests()
 {
     Dispatcher = new TestDispatcher(MockedDependencyContainer.Object);
 }
        public void SetItemUsesDispatcherToSetItems()
        {
            var initialElement = new Element();
            var collection = new BindableCollection<Element>() { initialElement };
            var element = new Element();

            var dispatcher = new TestDispatcher();
            Execute.Dispatcher = dispatcher;

            collection[0] = element;

            Assert.AreEqual(initialElement, collection[0]);
            Assert.NotNull(dispatcher.SendAction);

            dispatcher.SendAction();

            Assert.AreEqual(element, collection[0]);
        }
    static void Main(string[] args)
    {
      "Testing AbstractCommunicator".Title();

      TestCommunicator tc1 = new TestCommunicator();
      tc1.Name = "tc1";
      tc1.Start();

      TestCommunicator tc2 = new TestCommunicator();
      tc2.Name = "tc2";
      tc2.Start();

      TestDispatcher td = new TestDispatcher();
      td.Name = "td";
      td.Verbose = true;
      td.Start();
      td.Register(tc1);

      // show that GetInstance works

      AbstractMessageDispatcher tdi = TestDispatcher.GetInstance();
      tdi.Register(tc2);

      ServiceMessage msg0 = ServiceMessage.MakeMessage("foobar", "Main", "going nowhere");
      td.PostMessage(msg0);
      ServiceMessage msg1 = ServiceMessage.MakeMessage(tc1.Name, "Main", "some boring contents");
      td.PostMessage(msg1);
      ServiceMessage msg2 = ServiceMessage.MakeMessage(tc2.Name, "Main", "more boring contents");
      td.PostMessage(msg2);
      ServiceMessage msg3 = ServiceMessage.MakeMessage(tc1.Name, "Main", "quit");
      td.PostMessage(msg3);
      ServiceMessage msg4 = ServiceMessage.MakeMessage(tc2.Name, "Main", "quit");
      td.PostMessage(msg4);
      ServiceMessage msg5 = ServiceMessage.MakeMessage(td.Name, "Main", "quit");
      td.PostMessage(msg5);

      tc1.Wait();
      tc2.Wait();
      td.Wait();

      Console.Write("\n\n");
    }