Esempio n. 1
0
        public void TestApiKeyQueryAll()
        {
            ApiKey key = new ApiKey();
            key.Save();
            Balanced.Balanced.configure(key.secret);
            Marketplace marketplace = new Marketplace();
            marketplace.Save();

            ApiKey key1 = new ApiKey();
            key1.SaveToMarketplace();
        
            ApiKey key2 = new ApiKey();
            key2.SaveToMarketplace();
        
            ApiKey key3 = new ApiKey();
            key3.SaveToMarketplace();
        
            List<ApiKey> keys = ApiKey.Query().All();
            Assert.AreEqual(4, keys.Count);
            List<String> key_guids = new List<String>();
            foreach (ApiKey k in keys) {
                key_guids.Add(k.id);
            }
            Assert.IsTrue(key_guids.Contains(key1.id));
            Assert.IsTrue(key_guids.Contains(key2.id));
            Assert.IsTrue(key_guids.Contains(key3.id));
        }
Esempio n. 2
0
 public void setUp()
 {
     ApiKey key = new ApiKey();
     key.Save();
     Balanced.Balanced.configure(key.secret);
     Marketplace marketplace = new Marketplace();
     marketplace.Save();
     mp = marketplace;
 }
Esempio n. 3
0
 protected BankAccount CreateBankAccount(Marketplace mp)
 {
     if (mp == null)
         mp = Mine;
     return mp.TokenizeBankAccount(
         "Homer Jay",
         "112233a",
         "121042882");
 }
        public static Marketplace Mine()
        {
            Marketplace mp = Marketplace.Query().First();

            if (mp == null)
            {
                throw new SystemException("A Marketplace is required but was not found");
            }
            return(mp);
        }
Esempio n. 5
0
 static Test()
 {
     String location = Environment.GetEnvironmentVariable("BALANCED_LOCATION");
     if (location != null)
         Location = location;
     String secret = Environment.GetEnvironmentVariable("BALANCED_SECRET");
     if (secret != null)
         Secret = secret;
     Settings.configure(Secret, Location);
     Mine = Marketplace.Mine;
 }
        public void TestMine()
        {
            Settings.configure(null);

            var key = new APIKey();
            key.Save();
            Settings.configure(key.Secret);

            var mp = new Marketplace();
            Assert.IsNull(mp.Id);
            mp.Save();

            Assert.AreEqual(mp.Id, Marketplace.Mine.Id);
        }
        public void TestCreate()
        {
            Settings.configure(null);

            var key = new APIKey();
            key.Save();
            Settings.configure(key.Secret);

            var mp = new Marketplace();
            Assert.IsNull(mp.Id);
            mp.Save();

            Assert.IsNotNull(mp.Id);
        }
 public void TestDoubleCreate()
 {
     var mp = new Marketplace();
     mp.Save();
 }