Пример #1
0
        public void TestPublicAPIWithMultiAccounts()
        {
            isPublicAPILogin = PublicAuthentication.Authenticate(AuthenticationInfoProvider.Current.DefaultAppKey, AuthenticationInfoProvider.Current.DefaultAppSecret);

            Assert.IsTrue(isPublicAPILogin);
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "request_type", "1" }
            };
            ReadResponseData <Partition> result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess <Partition>(parameters);

            Assert.NotNull(result);
            Assert.NotNull(result.Items);
            Assert.AreEqual(result.Items.Count, 1);
            Assert.AreEqual(result.Items[0].Id, AuthenticationInfoProvider.Current.DefaultPartition);

            isPublicAPILogin = PublicAuthentication.Authenticate(PublicAPIConfig.GetValueFromConfig("AppId2"),
                                                                 PublicAPIConfig.GetValueFromConfig("AppSecret2"));

            Assert.IsTrue(isPublicAPILogin);
            parameters = new Dictionary <string, object>()
            {
                { "request_type", "1" }
            };
            result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess <Partition>(parameters);
            Assert.NotNull(result);
            Assert.NotNull(result.Items);
            Assert.AreEqual(result.Items.Count, 1);
            Assert.AreEqual(result.Items[0].Id, PublicAPIConfig.GetValueFromConfig("Partition2"));
        }
Пример #2
0
 public void TestPublicAPILoginFail()
 {
     isPublicAPILogin = PublicAuthentication.Authenticate(AuthenticationInfoProvider.Current.DefaultAppKey, Util.GetUniqueString(16));
     Assert.IsFalse(isPublicAPILogin);
 }