public async Task PreviewCommandIgnoresInvalidCommand() { var sourceControl = Substitute.For <ISourceControl>(); var target = new PreviewCommandHandler(sourceControl); dynamic command = new System.Dynamic.ExpandoObject(); command.Type = "Invalid"; await HandleCommand(target, command); await sourceControl.DidNotReceive().Preview(Arg.Any <string>(), Arg.Any <int>()); }
public async Task PreviewCommandHandlesValidCommand() { using var file = new TemporaryFile(); var sourceControl = Substitute.For <ISourceControl>(); sourceControl.Preview(Arg.Any <string>(), Arg.Any <int>()).Returns(new Document()); var target = new PreviewCommandHandler(sourceControl); dynamic command = new System.Dynamic.ExpandoObject(); command.Type = "Preview"; command.Path = file.Fullname; command.Bookmark = "4"; command.Destination = "Destination"; await HandleCommand(target, command); await sourceControl.Received().Preview(file.Fullname, 4); }