public async Task Down_ForInvokedWithUnknownCommand_ReturnsFalse( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider, [Freeze] IControl control) { provider.TryGetValue(DeskCommands.MoveDown, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = null; return(false); }); await sut.Down( ); await control.DidNotReceive( ) .TryWriteRawControl2(Arg.Any <IEnumerable <byte> > ( )); }
public async Task Down_ForInvoked_ReturnsTrueForSuccess( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider) { var bytes = new byte [] { 0, 1 }; provider.TryGetValue(DeskCommands.MoveDown, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = bytes; return(true); }); var actual = await sut.Down( ); actual.Should( ) .BeTrue( ); }
public async Task Down_ForInvoked_CallsControl( DeskCommandExecutor sut, [Freeze] IDeskCommandsProvider provider, [Freeze] IControl control) { var bytes = new byte [] { 0, 1 }; provider.TryGetValue(DeskCommands.MoveDown, out Arg.Any <IEnumerable <byte> > ( )) .Returns(x => { x [1] = bytes; return(true); }); await sut.Down( ); await control.Received( ) .TryWriteRawControl2(bytes); }