-
-
Save MikeBild/3716031 to your computer and use it in GitHub Desktop.
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>()), | |
}); |
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>()), }); };
Ich bekomme das Beispiel nicht so richtig umgesetzt. Gegenbeispiel mit MSpec:
Hier gehts nur mit .First(), oder?