public static void SetPushClient(this HttpConfiguration config, PushClient client)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            config.Properties[PushClientKey] = client;
        }
        public PushClientTests()
        {
            this.settings = new MobileAppSettingsDictionary();
            this.settingsProviderMock = new Mock<IMobileAppSettingsProvider>();
            this.settingsProviderMock.Setup(p => p.GetMobileAppSettings())
                .Returns(this.settings);

            this.config = new HttpConfiguration();
            this.config.SetMobileAppSettingsProvider(this.settingsProviderMock.Object);
            this.clientMock = new Mock<PushClient>(this.config) { CallBase = true };
            this.client = this.clientMock.Object;
        }
Beispiel #3
0
        public PushClientTests()
        {
            this.settings             = new MobileAppSettingsDictionary();
            this.settingsProviderMock = new Mock <IMobileAppSettingsProvider>();
            this.settingsProviderMock.Setup(p => p.GetMobileAppSettings())
            .Returns(this.settings);

            this.config = new HttpConfiguration();
            this.config.SetMobileAppSettingsProvider(this.settingsProviderMock.Object);
            this.clientMock = new Mock <PushClient>(this.config)
            {
                CallBase = true
            };
            this.client = this.clientMock.Object;
        }
        public static PushClient GetPushClient(this HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            PushClient client;
            if (!config.Properties.TryGetValue(PushClientKey, out client))
            {
                client = new PushClient(config);
                config.Properties[PushClientKey] = client;
            }

            return client;
        }
 protected override void Initialize(HttpControllerContext controllerContext)
 {
     base.Initialize(controllerContext);
     this.traceWriter = this.Configuration.Services.GetTraceWriter();
     this.pushClient = new PushClient(this.Configuration);
 }