private void UpdateCompatibility(KeyboardComponentFeatures compatibility)
 {
     EnableFeatureEditing          = compatibility.HasFlag(KeyboardComponentFeatures.Enhances);
     EnableCassetteOptionSelection = EnableFeatureEditing && UsesCassette;
     if (!EnableFeatureEditing)
     {
         UsesCassette   = false;
         UsesPrinter    = false;
         UsesMicrophone = false;
         Basic          = null;
     }
     else
     {
         if (Basic == null)
         {
             Basic = BasicOptions.First(b => b.Flags == (uint)KeyboardComponentFeatures.BasicTolerated);
         }
         if (compatibility == KeyboardComponentFeatures.Enhances)
         {
             if ((Basic != null) && (Basic.Flags == (uint)KeyboardComponentFeatures.BasicRequired))
             {
                 Basic = BasicOptions.First(b => b.Flags == (uint)KeyboardComponentFeatures.BasicTolerated);
             }
             if ((Cassette != null) && (Cassette.Flags == (uint)KeyboardComponentFeatures.TapeRequired))
             {
                 Cassette = CassetteOptions.First(c => c.Flags == (uint)KeyboardComponentFeatures.TapeOptional);
             }
         }
     }
 }
示例#2
0
        public IntegrationTests(WebApplicationFactory <Startup> factory1, CustomWebApplicationFactory <Startup> factory2)
        {
            _geoApi1 = RestService.For <IGeoApi>(factory1.CreateClient());
            _cache1  = factory1.Server.Host.Services.GetRequiredService <IDistributedCache>();

            _geoApi2  = RestService.For <IGeoApi>(factory2.CreateClient());
            _cache2   = factory2.Server.Host.Services.GetRequiredService <IDistributedCache>();
            _options2 = factory2.Server.Host.Services.GetRequiredService <IOptions <CassetteOptions> >().Value;
        }
 private void UpdateCassetteOptions(bool usesCassette)
 {
     if (usesCassette && (Cassette == null))
     {
         Cassette = CassetteOptions.First(c => c.Flags == (uint)KeyboardComponentFeatures.TapeOptional);
     }
     else if (!usesCassette)
     {
         Cassette = null;
     }
     EnableCassetteOptionSelection = EnableFeatureEditing && UsesCassette;
 }
 /// <inheritdoc />
 public override void Initialize(ProgramFeatures features)
 {
     base.Initialize(features);
     _keyboardComponent = KeyboardComponentOptions.FirstOrDefault(e => (e != null) && (e.Flags == ((uint)features.KeyboardComponent & FeatureCompatibilityHelpers.CompatibilityMask)));
     _usesMicrophone    = features.KeyboardComponent.HasFlag(KeyboardComponentFeatures.Microphone);
     _usesPrinter       = features.KeyboardComponent.HasFlag(KeyboardComponentFeatures.Printer);
     _usesCassette      = features.KeyboardComponent.HasFlag(KeyboardComponentFeatures.TapeOptional) || features.KeyboardComponent.HasFlag(KeyboardComponentFeatures.TapeRequired);
     _cassette          = CassetteOptions.FirstOrDefault(s => s.Flags == (uint)(features.KeyboardComponent & KeyboardComponentFeaturesHelpers.TapeMask));
     _basic             = BasicOptions.FirstOrDefault(s => s.Flags == (uint)(features.KeyboardComponent & KeyboardComponentFeaturesHelpers.BasicMask));
     RaiseAllPropertiesChanged();
     UpdateCompatibility((KeyboardComponentFeatures)_keyboardComponent.Flags);
 }
        /// <summary>
        /// Gets a new <see cref="HttpMessageHandler" /> for recording, can be used to wrap an
        /// existing <see cref="HttpMessageHandler" /> before passing to a client
        /// </summary>
        /// <param name="cassette">The recorder.</param>
        /// <param name="innerHandler">The inner handler; optional, defaults to creating a new <see cref="HttpClientHandler" />.</param>
        /// <param name="options">The options.</param>
        /// <param name="callerFilePath">The caller file path.</param>
        /// <param name="callerMemberName">Name of the caller member.</param>
        /// <param name="callerLineNumber">The caller line number.</param>
        /// <returns></returns>
        public RecordingMessageHandler(
            Cassette cassette,
            HttpMessageHandler innerHandler,
            CassetteOptions options,
            string callerFilePath,
            string callerMemberName,
            int callerLineNumber)
        {
            _cassette         = cassette;
            _options          = options;
            _callerFilePath   = callerFilePath;
            _callerMemberName = callerMemberName;
            _callerLineNumber = callerLineNumber;

#pragma warning disable DF0020 // Marks undisposed objects assinged to a field, originated in an object creation.
            if (innerHandler is null)
            {
                innerHandler  = new HttpClientHandler();
                _disposeInner = 1;
            }
#pragma warning restore DF0020 // Marks undisposed objects assinged to a field, originated in an object creation.
            InnerHandler = innerHandler;
        }