public void Single_Thread_Test() { SuperLogSingleton sl1 = SuperLogSingleton.Instance; sl1.AddLine("I'm the first line"); SuperLogSingleton sl2 = SuperLogSingleton.Instance; sl2.AddLine("I'm supposed to be the second line"); Assert.Equal(sl1.Output, sl2.Output); }
public void MultiTread_Test() { SuperLogSingleton sl1 = SuperLogSingleton.Instance; sl1.AddLine("I'm the first line"); var output1 = sl1.Output; var process = new OtherThread(); Thread thread1 = new Thread(new ThreadStart(process.SimpleMethod)); thread1.Start(); //Waits until the thread ends thread1.Join(); Assert.Equal(output1 + "I'm the second line\n", sl1.Output); }
public void SimpleMethod() { SuperLogSingleton sl2 = SuperLogSingleton.Instance; sl2.AddLine("I'm the second line"); }