示例#1
0
        public UTSession
        (
            IUTSessionConfig config,
            IUTInteraction defaultInteraction,
            string deviceIdentifier,
            string uTTokenValue,
            IUTGrammar grammar = null
        )
        {
            if (null == config)
            {
                throw new ArgumentNullException(nameof(UTSession), " config can not be null");
            }

            if (grammar == null)
            {
                grammar = UTGrammar.UTV1Grammar();
            }

            this.utGrammar = grammar;

            this.defaultInteraction      = defaultInteraction;
            this.defaultDeviceIdentifier = deviceIdentifier;

            this.sessionConfig = config.SessionConfigShallowCopy();
            this.requestMerger = new UserRequestMerger(this.sessionConfig, this.defaultDeviceIdentifier);

            this.uTTokenValue = uTTokenValue;

            this.cookies = new CookieContainer();
            this.handler = new HttpClientHandler();
            this.handler.CookieContainer = cookies;
            this.httpClient = new HttpClient(this.handler);
        }
        public IUTSessionBuilder DefaultInteraction(IUTInteraction interaction)
        {
            if (interaction == null)
            {
                return(this);
            }

            BaseValidator.CheckForTwiceSetAndThrow(this.defaultInteractionValue, this.GetType().Name + ".defaultInteraction");

            this.defaultInteractionValue = interaction;

            return(this);
        }
        public virtual ITrackInteractionRequest DeepCopyTrackInteractionRequest()
        {
            IUTSessionConfig connection    = null;
            IUTInteraction   uTInteraction = null;

            if (null != this.SessionConfig)
            {
                connection = this.SessionConfig.SessionConfigShallowCopy();
            }

            if (null != this.Interaction)
            {
                uTInteraction = this.Interaction;
            }

            return(new TrackInteractionParameters(connection, uTInteraction));
        }
 public TrackInteractionParameters(IUTSessionConfig sessionConfig, IUTInteraction uTInteraction)
 {
     this.SessionConfig = sessionConfig;
     this.Interaction   = uTInteraction;
 }