public void VkApiProvider_VkApi_Environment_References() { var environmentA = VkApiProvider.Get() .GetEnvironment(); var environmentB = VkApiProvider.Get() .GetEnvironment(); Assert.NotEqual(environmentA, environmentB); VkApiProvider.Get() .Authorize(new AuthorizationData("access_token")); var accessToken = VkApiProvider.Get() .GetEnvironment() .AccessToken; Assert.Equal("access_token", accessToken); VkApiProvider.Get() .GetEnvironment() .AccessToken = "new_access_token"; accessToken = VkApiProvider.Get() .GetEnvironment() .AccessToken; Assert.Equal("access_token", accessToken); }
public PullerStrategies(VkApiProvider vkApi, JsApiProvider jsApi) { _actualContentPullerStrategy = new VkActualContentPullerStrategy(vkApi.WallGet); _actualTimePeriodContentPullerStrategy = new VkActualTimePeriodContentPullerStrategy(vkApi.WallGet); _postponedContentPullerStrategy = new VkPostponedContentPullerStrategy(vkApi.WallGet); _historyContentPullerStrategy = new HistoryContentPullerStrategy(jsApi.GetPosts); }
public static void Ban() { var response = VkApiProvider.Get() .GetAccount() .Ban(new ParametersBan { OwnerId = 95167253 }); Console.WriteLine(response.Result); }
private static void Main() { VkApiProvider.Get() .Authorize(new AuthorizationData(AccessToken)); // Account(); // Database(); Console.ReadKey(); }
public static void GetChairs() { var response = VkApiProvider.Get() .GetDatabase() .GetChairs(new ParametersGetChairs { FacultyId = 15 }); Console.WriteLine(Serializer.Serialize(response.Items)); }
public AuthBarViewModel(IEventAggregator eventAggregator, VkApiProvider vkApi) { _eventAggregator = eventAggregator; _vkApi = vkApi; AuthorizeCommand = new DelegateCommand(authorizeCommandExecute, () => !IsBusy).ObservesProperty(() => IsBusy); LogOutCommand = new DelegateCommand(logOutCommandExecute, () => !IsBusy).ObservesProperty(() => IsBusy); _eventAggregator.GetEvent <AuthBarEvents.AuthorizeIfAlreadyLoggined>().Subscribe(authorizeIfAlreadyLoggined); _eventAggregator.GetEvent <VkAuthorizationEvents.AcquiredTheToken>().Subscribe(onTokenAcquired); }
public void VkApiProvider_References_Test() { var account = VkApiProvider .GetVkApi() .GetAccount(); Assert.Same(account, VkApiProvider.GetAccount()); account = VkApiProvider .GetAccount(); Assert.Same(account, VkApiProvider.GetAccount()); }
private static void Main() { // На данный момент авторизация производится по уже полученному ключу доступа. // Полученный ключ доступа необходимо вставить в файл "access_token.json". VkApiProvider.Authorize(new AuthorizationData(Data.AccessToken)); Console.WriteLine( VkApiProvider .GetEnvironment() .AccessToken ); Console.ReadKey(); }
public void Setup() { var token = new AccessToken(); var handler = new FakeResponseHandlerByHost(); handler.AddFakeResponse(new Uri($"https://api.vk.com/method/wall.get?"), new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(Resources.FakeWallGetResponse) }); var vkApi = new vk.Models.VkApi.VkApi(token, handler); _apiProvider = new VkApiProvider(token, vkApi); }
public void EnvironmentProvider_Deauthorization_Test() { VkApiProvider .GetVkApi() .Authorize(new AuthorizationData(AccessToken)); VkApiProvider .GetAccount() .GetInfo(); VkApiProvider.Deauthorize(); // Возникнет исключение, так как была произведена деавторизация (очищено окружение). Assert.Throws <InvalidAccessTokenException>(() => VkApiProvider.GetAccount().GetInfo()); }
public void VkApiProvider_VkApi_Modules_References() { var moduleA = VkApiProvider.Get() .GetAccount(); var moduleB = VkApiProvider.Get() .GetAccount(); Assert.Equal(moduleA, moduleB); var moduleC = VkApiProvider.Get(InstanceMode.New) .GetAccount(); Assert.NotEqual(moduleA, moduleC); Assert.NotEqual(moduleB, moduleC); }
public void VkApiProvider_VkApi_References() { var vkA = VkApiProvider.Get(); var vkB = VkApiProvider.Get(); Assert.Equal(vkA, vkB); vkA = VkApiProvider.Get(InstanceMode.New); vkB = VkApiProvider.Get(InstanceMode.New); Assert.NotEqual(vkA, vkB); vkA = VkApiProvider.Get(InstanceMode.New); vkB = VkApiProvider.Get(); Assert.Equal(vkA, vkB); }
public void EnvironmentProvider_Mutations_Test() { var environment = VkApiProvider .GetMessages() .GetEnvironment(); Assert.Equal(AccessToken, environment.AccessToken); VkApiProvider .GetMessages() .GetEnvironment() .AccessToken = "new_access_token"; environment = VkApiProvider .GetEnvironmentProvider() .GetEnvironment(); Assert.Equal(AccessToken, environment.AccessToken); }
public ProvidersTests() { VkApiProvider .GetVkApi() .Authorize(new AuthorizationData(AccessToken)); }
public IAccount GetAccount() { return(VkApiProvider.GetAccount()); }
public VkPostViewModelBuilder(VkApiProvider api) { _api = api; }
public HistoryController(IHistoryPublisher historyPublisher, VkApiProvider api) { _historyPublisher = historyPublisher; _api = api; }
public VkProvider() { Api = new VkApiProvider(Config["access_token"].ToString(), Config["version"].ToString()); }
public IWall GetWall() { return(VkApiProvider.GetWall()); }
public IAds GetAds() { return(VkApiProvider.GetAds()); }
public UploaderViewModel(IEventAggregator eventAggregator, VkUploader uploader, UploadSettings uploadSettings, VkApiProvider vkApi, PullersController pullersController) { _eventAggregator = eventAggregator; _uploader = uploader; _uploadSettings = uploadSettings; _vkApi = vkApi; _pullersController = pullersController; MissingDates = new List <int>(); _pullersController.Postponed.PullInvoked += onPostponedPullInvoked; _pullersController.Postponed.PullCompleted += onPostponedPullCompleted; _pullersController.Postponed.WallHolderChanged += onPostponedWallHolderChanged; _shrinkAfterPublish = _uploadSettings.CloseUploadWindowAfterPublish; _signedPost = _uploadSettings.SignedPosting; _postFromGroup = _uploadSettings.PostFromGroup; Attachments = new ObservableCollection <AttachmentItem>(); _cts = new CancellationTokenSource(); CancelCommand = new DelegateCommand(() => { _cts.Cancel(); }, () => IsShowing) .ObservesProperty(() => IsShowing); ShowHideCommand = new DelegateCommand(() => { IsShowing = !IsShowing; }); PublishCommand = DelegateCommand.FromAsyncHandler(publishExecute, () => IsEnabled && IsShowing && !IsBusy && (!string.IsNullOrWhiteSpace(Message) || Attachments.Any())) .ObservesProperty(() => IsShowing) .ObservesProperty(() => IsBusy) .ObservesProperty(() => Message) .ObservesProperty(() => Attachments) .ObservesProperty(() => IsEnabled); BrowseCommand = DelegateCommand.FromAsyncHandler(browseExecute, () => IsShowing) .ObservesProperty(() => IsShowing); MovePreviousCommand = new DelegateCommand(moveToPreviousMissing); MoveNextCommand = new DelegateCommand(moveToNextMissing); //_eventAggregator.GetEvent<MainBottomEvents.Refresh>().Subscribe(async () => { // if (IsBusy || !IsEnabled) return; // IsBusy = true; // ProgressString = "Pull..."; // try { // await _wallContainer.PullWithScheduleHightlightAsync(new MissingPostFilter(), new Schedule()); // } // finally { // IsBusy = false; // ProgressString = ""; // } //}); _eventAggregator.GetEvent <UploaderEvents.SetVisibility>().Subscribe(onSetVisibility); _eventAggregator.GetEvent <UploaderEvents.Configure>().Subscribe(onConfigure); }
public HistoryPostViewModelBuilder(VkApiProvider api) { _api = api; }
public IMessages GetMessages() { return(VkApiProvider.GetMessages()); }