Читать книгу Dojos für Entwickler 2 - Stefan Lieser - Страница 57

Listing 8 Test für Windows Forms.

Оглавление

[Test] public void Result_Event_wird_auf_Zielthread_ausgeführt_wenn_das_Ziel_WinForms_ist() { var myForm = new Form(); sut = new Synchronizer<int>(); var mainThreadId = Thread.CurrentThread. ManagedThreadId; sut.Result += _ => { Assert.That(Thread.CurrentThread. ManagedThreadId, Is.EqualTo(mainThreadId)); myForm.Close(); }; var thread = new Thread(() => sut.Process(1)); thread.Start(); Application.Run(myForm); }

Dojos für Entwickler 2

Подняться наверх