Created
September 13, 2012 17:30
-
-
Save MikeBild/3716031 to your computer and use it in GitHub Desktop.
Rx-Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sut = Observable.Start(() => | |
{ | |
return "Demo"; | |
}); | |
var testScheduler = new Microsoft.Reactive.Testing.TestScheduler(); | |
var actual = testScheduler.Start(() => sut); | |
Microsoft.Reactive.Testing.ReactiveAssert.AreElementsEqual(actual.Messages, new[] { | |
new Recorded<Notification<string>>(200, Notification.CreateOnNext("Demo")), | |
new Recorded<Notification<string>>(200, Notification.CreateOnCompleted<string>()), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ich bin mir nicht ganz sicher, was Du eigentlich testen wolltest. Ich hab das jetzt mal, ohne eigenen verifizierten Lauf, mal zusammen kopiert. Vielleicht kannst Du das auch nochmal per Spec beschreiben?!?
Establish context = () => { var testScheduler = new Microsoft.Reactive.Testing.TestScheduler(); _sut_journal = new Journal(); _sut_subject = new StudioFilesReader(_sut_journal); }; Because of = () => { _actual = testScheduler.Start(() => _sut_subject.ReadProjectFile(FileName)); //Hier ist Deinem Beispiel dann ReadSolutionFile gemeint oder? } It should_add_projects_visit_to_journal = () => Microsoft.Reactive.Testing.ReactiveAssert.AreElementsEqual(actual.Messages, new[] { new Recorded<Notification<StudioSolution>>(200, Notification.CreateOnNext(new StudioSolution() { ... })), new Recorded<Notification<StudioSolution>>(200, Notification.CreateOnCompleted<StudioSolution>()), }); }; It should_contains_a_journal_entry = () => Microsoft.Reactive.Testing.ReactiveAssert.AreElementsEqual(_sut_journal.Messages, new[] { new Recorded<Notification<JournalEntry>>(200, Notification.CreateOnNext(new JournalEntry() { ... })), new Recorded<Notification<JournalEntry>>(200, Notification.CreateOnCompleted<JournalEntry>()), }); };