public async Task Delete() { var app = new KZApplication(test.Constants.MarketplaceUrl, test.Constants.AppName); await app.Initialize(); var user = await app.Authenticate(test.Constants.User, test.Constants.Password, test.Constants.Provider); var files = app.Files; var uploadResult = await files.Upload(file, "/foo.txt"); var result = await files.Browse("/"); Assert.AreEqual(1, result.Data.files .Where(f => f.name == "foo.txt") .Count()); var delResult = await files.Delete("/foo.txt"); Assert.AreEqual(HttpStatusCode.NoContent, delResult.StatusCode); Assert.IsTrue(delResult.Data); result = await files.Browse("/"); Assert.AreEqual(0, result.Data.files .Where(f => f.name == "foo.txt") .Count()); EnqueueTestComplete(); }
public async void ShouldReturnIsInitialized() { var app = new KZApplication(Constants.marketplace, Constants.application); await app.Initialize(); Assert.That(app.Initialized, Is.True); }
public void SetUp() { Console.WriteLine("Setting up"); if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } if (queryDataSrc == null) { queryDataSrc = app.DataSource["GetCityWeather"]; } if (invokeDataSrc == null) { invokeDataSrc = app.DataSource["InvokeCityWeather"]; } if (queryWithData == null) { queryWithData = app.DataSource["GetCityWeather"]; } if (invokeWithData == null) { invokeWithData = app.DataSource["InvokeCityWeather"]; } }
static public async Task ClassInit(TestContext context) #endif { app = new KZApplication(test.Constants.MarketplaceUrl, test.Constants.AppName); await app.Initialize(); EnqueueTestComplete(); }
public async void ShouldAuthenticate() { var app = new KZApplication(Constants.marketplace, Constants.application); await app.Initialize(); var t = app.Authenticate(Constants.user, Constants.pass, Constants.provider); await t.ContinueWith((r) => { Assert.IsNotNull(r.Result.TokenMarketplace); }); }
public void ShouldInitialize() { //arrange var app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); //act app.Initialize().Wait(); //assert Assert.AreEqual(true, app.Initialized); }
static public async Task ClassInit(TestContext context) #endif { app = new KZApplication(test.Constants.MarketplaceUrl, test.Constants.AppName); await app.Initialize(); var user = await app.Authenticate(test.Constants.User, test.Constants.Password, test.Constants.Provider); service = app.Service["echo"]; EnqueueTestComplete(); }
private async Task InitApplication() { if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application); await app.Initialize(); await app.Authenticate(Constants.user, Constants.pass, Constants.provider); } await InitStorage(); }
public void ShouldAuthenticate() { //arrange var app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); //act var user = app.Authenticate(Constants.user, Constants.pass, Constants.provider).Result; //assert Assert.IsNotNull(user.TokenMarketplace); Assert.AreEqual(true, app.Authenticated); }
public void SetUp() { Console.WriteLine("Setting up"); if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } if (sms == null) { sms = app.SmsSender["+13053038639"]; } }
public void SetUp() { Console.WriteLine("Setting up"); if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } if (queue == null) { queue = app.Queue["foo"]; } }
public static void Authenticate(this KZApplication application, Context context, KZApplication.OnEventHandler onAuthFinish) { appContext = context; if (!application.Initialized) { application.Initialize().Wait(); } PassiveAuthSettings = new Dictionary <string, string>(); KidozenApplicationConfig = application.ApplicationConfiguration; PassiveAuthSettings.Add("grant_type", "refresh_token"); PassiveAuthSettings.Add("client_secret", application.applicationKey); PassiveAuthSettings.Add("client_id", Validate(KidozenApplicationConfig, "domain") ); PassiveAuthSettings.Add("scope", Validate(KidozenApplicationConfig.Value <JObject> ("authConfig"), "applicationScope") ); PassiveAuthSettings.Add("oauthTokenEndpoint", Validate(KidozenApplicationConfig.Value <JObject> ("authConfig"), "oauthTokenEndpoint") ); var signInUrl = Validate(application.ApplicationConfiguration.Value <JObject> ("authConfig"), "signInUrl"); var startPassiveAuth = new Intent(appContext, typeof(PassiveAuthActivity)); startPassiveAuth.AddFlags(ActivityFlags.NewTask); startPassiveAuth.PutExtra("signInUrl", signInUrl); appContext.StartActivity(startPassiveAuth); AuthenticationEventManager.AuthenticationResponseArrived += (object sender, AuthenticationResponseEventArgs e) => { Console.WriteLine("*** Success : " + e.Success); application.Authenticated = e.Success; if (e.Success) { application.PassiveAuthenticationInformation = e.TokenInfo; } else { //TODO: display alert } if (onAuthFinish != null) { onAuthFinish.Invoke(application, e); } }; }
static public async Task ClassInit(TestContext context) #endif { var bytes = UTF8Encoding.UTF8.GetBytes("sample file"); file = new MemoryStream(); file.Write(bytes, 0, bytes.Length); file.Flush(); app = new KZApplication(test.Constants.MarketplaceUrl, test.Constants.AppName); await app.Initialize(); var user = await app.Authenticate(test.Constants.User, test.Constants.Password, test.Constants.Provider); files = app.Files; EnqueueTestComplete(); }
public void SetUp() { Console.WriteLine("Setting up"); if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } if (logging == null) { logging = app.Logger; } logging.Write("foo", LogLevel.LogLevelVerbose).Wait(); logging.Clear().Wait(); }
public static void Authenticate(this KZApplication application, KZApplication.OnEventHandler onAuthFinish) { PassiveAuthSettings = new Dictionary <string, string>(); if (!application.Initialized) { application.Initialize().Wait(); } KidozenApplicationConfig = application.ApplicationConfiguration; PassiveAuthSettings.Add("grant_type", "refresh_token"); PassiveAuthSettings.Add("client_secret", application.applicationKey); PassiveAuthSettings.Add("client_id", Validate(KidozenApplicationConfig, "domain")); PassiveAuthSettings.Add("scope", Validate(KidozenApplicationConfig.Value <JObject> ("authConfig"), "applicationScope")); PassiveAuthSettings.Add("oauthTokenEndpoint", Validate(KidozenApplicationConfig.Value <JObject> ("authConfig"), "oauthTokenEndpoint")); var signInUrl = Validate(KidozenApplicationConfig.Value <JObject> ("authConfig"), "signInUrl"); var authController = new PassiveAuthViewController(signInUrl); var wv = new UINavigationController(authController); authController.AuthenticationResponseArrived += (object sender, AuthenticationResponseEventArgs e) => { Console.WriteLine("*** Success : " + e.Success); application.Authenticated = e.Success; if (e.Success) { application.PassiveAuthenticationInformation = new Dictionary <string, string>(e.TokenInfo); } else { //TODO: display alert } if (onAuthFinish != null) { onAuthFinish.Invoke(application, e); } }; UIApplication.SharedApplication.Delegate.Window.RootViewController.PresentViewController(wv, true, new NSAction(() => { Console.WriteLine("loading"); })); //OnPassiveAuthentication.Invoke(application, new PassiveAuthenticationEventArgs {Success=e.Success}); }
public async void Subscribe() { var app = new KZApplication(Constants.marketplace, Constants.application); await app.Initialize(); var user = await app.Authenticate(Constants.user, Constants.pass, Constants.provider); var channel = app.PubSubChannel ["pubsubchanneltest"]; var rnd = Guid.NewGuid().ToString(); channel.Susbscribe <ChannelMessage> (msg => { Assert.Equals(rnd, msg.value); autoEvent.Set(); }, err => { if (err != null) { Assert.Fail(); } }); var message = new ChannelMessage { value = rnd }; var response = channel.Publish(message); //Assert.AreEqual(HttpStatusCode.Created, response.Result.StatusCode); if (autoEvent.WaitOne(60000)) { Assert.True(1 == 1); } else { Assert.Fail(); } }
static public async Task ClassInit(TestContext context) #endif { if (app == null) { app = new KZApplication(Constants.MarketplaceUrl, Constants.AppName); await app.Initialize(); var user = await app.Authenticate(Constants.User, Constants.Password, Constants.Provider); } if (queryDataSrc == null) { queryDataSrc = app.DataSource["test-query"]; } if (invokeDataSrc == null) { invokeDataSrc = app.DataSource["test-operation"]; } EnqueueTestComplete(); }
public void SetUp() { Console.WriteLine("Setting up"); Stopwatch sw = new Stopwatch(); sw.Start(); if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } sw.Stop(); Console.WriteLine("Elapsed={0}", sw.Elapsed); if (mail == null) { mail = app.MailSender; } }
public void SetUp() { Console.WriteLine("Setting up"); ServicePointManager.ServerCertificateValidationCallback = (x, w, y, z) => true; if (app == null) { app = new KZApplication(Constants.marketplace, Constants.application, Constants.applicationKey); app.Initialize().Wait(); app.Authenticate(Constants.user, Constants.pass, Constants.provider).Wait(); } if (objectSet == null) { objectSet = app.Storage["test-monodroid"]; } //insert just in case the object set doesn't exist objectSet.Insert(new { Foo = "foo" }).Wait(); //drop the object set. var dropResult = objectSet.Drop().Result; Assert.AreEqual(HttpStatusCode.OK, dropResult.StatusCode); }