public void When_A_Word_Is_Predicted_It_Must_Appears_In_Prediction_Zone()
{
// Texual service plugin usage
var textualService = new TextualContextService()
{
//SendKeyService = ServiceHelper.MockServiceWrapper<ISendKeyCommandHandlerService>(),
//SendStringService = ServiceHelper.MockServiceWrapper<ISendStringService>()
};
// Predictor service plugin usage
SybilleWordPredictorService.PluginDirectoryPath = TestHelper.SybilleResourceFullPath;
var predictorService = new SybilleWordPredictorService()
{
Feature = TestHelper.MockFeature( 10 ).Object,
TextualContextService = textualService,
};
// Mocking of IKeyboardContext
var mKbContext = TestHelper.MockKeyboardContext( TestHelper.CompatibilityKeyboardName, TestHelper.PredictionZoneName );
// The Plugin Under Test.
var pluginSut = new InKeyboardWordPredictor()
{
Feature = TestHelper.MockFeature( 10 ).Object,
WordPredictorService = predictorService.MockServiceWrapper<IWordPredictorService>(),
Context = mKbContext.Object
};
// Start all depending plugins
textualService.Start();
predictorService.Setup( null );
predictorService.Start();
pluginSut.Start();
Task.WaitAll( predictorService.AsyncEngineContinuation );
// Start test. When a token is inserted into the textual service, it will triggers the predictor service to make a prediction.
textualService.SetRawText( "J" );
Assert.That( predictorService.Words.Count > 0 );
// We need to assert that the SUT correctly creates Keys into the Prediction Zone, according to its specs.
// Test
var keys = pluginSut.Context.Keyboards[TestHelper.CompatibilityKeyboardName].Zones[ TestHelper.PredictionZoneName].Keys;
Assert.That( keys.Select( e => e.CurrentLayout.Current.Visible == true ).Count() == predictorService.Words.Count );
mKbContext.VerifyAll();
}