public async Task Up_ForInvokedWithUnknownCommand_ReturnsFalse( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider, [Freeze] IControl control) { provider.TryGetValue(DeskCommands.MoveUp, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = null; return(false); }); await sut.Up( ); await control.DidNotReceive( ) .TryWriteRawControl2(Arg.Any <IEnumerable <byte> > ( )); }
public async Task Stop_ForInvoked_ReturnsTrueForSuccess( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider) { var bytes = new byte [] { 0, 1 }; provider.TryGetValue(DeskCommands.MoveStop, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = bytes; return(true); }); var actual = await sut.Stop( ); actual.Should( ) .BeTrue( ); }
public async Task Stop_ForInvoked_CallsControl( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider, [Freeze] IControl control) { var bytes = new byte [] { 0, 1 }; provider.TryGetValue(DeskCommands.MoveStop, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = bytes; return(true); }); await sut.Stop( ); await control.Received( ) .TryWriteRawControl2(bytes); }