예제 #1
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public override bool Equals(IOAuthSource other)
 {
     if (other != null)
     {
         return(AppKey == other.AppKey && AccessToken == other.AccessToken);
     }
     return(false);
 }
예제 #2
0
        public void TestToModelNullItem()
        {
            //arrange
            _manageOAuthSourceViewModel.Item = null;

            //act
            IOAuthSource result = _manageOAuthSourceViewModel.ToModel();

            //assert
            Assert.IsNotNull(_manageOAuthSourceViewModel.Item);
        }
예제 #3
0
        public void TestToModelOtherItem()
        {
            //arrange
            _manageOAuthSourceViewModel.Item = new DropBoxSource();
            _manageOAuthSourceViewModel.SelectedOAuthProvider = "Other";

            //act
            IOAuthSource result = _manageOAuthSourceViewModel.ToModel();

            //assert
            Assert.IsNull(result);
        }
예제 #4
0
        public void SaveOAuthSource(IOAuthSource source, Guid serverWorkspaceID)
        {
            var con            = Connection;
            var comsController = CommunicationControllerFactory.CreateController("SaveOAuthSource");
            var serialiser     = new Dev2JsonSerializer();

            comsController.AddPayloadArgument("OAuthSource", serialiser.SerializeToBuilder(source));
            var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID);

            if (output.HasError)
            {
                throw new WarewolfSaveException(output.Message.ToString(), null);
            }
        }
예제 #5
0
        public void TestToModelDropBoxSourceItem()
        {
            //arrange
            _manageOAuthSourceViewModel.Item = new DropBoxSource();
            _manageOAuthSourceViewModel.SelectedOAuthProvider = "Dropbox";
            _manageOAuthSourceViewModel.AppKey      = "123";
            _manageOAuthSourceViewModel.AccessToken = "token";

            //act
            IOAuthSource result = _manageOAuthSourceViewModel.ToModel();

            //assert
            Assert.IsNotNull(_manageOAuthSourceViewModel.Item);
            Assert.AreEqual(result.AppKey, "123");
            Assert.AreEqual(result.AccessToken, "token");
        }
예제 #6
0
        public void TestToModelNullItemNullOAuthSource()
        {
            //arrange
            Mock <IRequestServiceNameViewModel> requestServiceNameViewModel     = new Mock <IRequestServiceNameViewModel>();
            Task <IRequestServiceNameViewModel> requestServiceNameViewModelTask = new Task <IRequestServiceNameViewModel>(() => requestServiceNameViewModel.Object);

            _manageOAuthSourceViewModel = new ManageOAuthSourceViewModel(_updateManager.Object, requestServiceNameViewModelTask);

            _manageOAuthSourceViewModel.Item        = null;
            _manageOAuthSourceViewModel.AppKey      = "123";
            _manageOAuthSourceViewModel.AccessToken = "token";

            //act
            IOAuthSource result = _manageOAuthSourceViewModel.ToModel();

            //assert
            Assert.IsNotNull(_manageOAuthSourceViewModel.Item);
            Assert.AreEqual(result.AccessToken, "token");
            Assert.AreEqual(result.AppKey, "123");
        }
 public void Save(IOAuthSource sharePointServiceSource) => UpdateManagerProxy.SaveOAuthSource(sharePointServiceSource, GlobalConstants.ServerWorkspaceID);
예제 #8
0
        public void TestManageOAuthSourceViewModelConstructorNullIOAuthSource()
        {
            IOAuthSource nullParam = null;

            new ManageOAuthSourceViewModel(_updateManager.Object, nullParam, new SynchronousAsyncWorker());
        }
 public void Save(IOAuthSource toDbSource)
 {
     _updateRepository.Save(toDbSource);
 }
예제 #10
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public abstract bool Equals(IOAuthSource other);
예제 #11
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public override bool Equals(IOAuthSource other)
 {
     // ReSharper disable once PossibleNullReferenceException
     return(AppKey == other.AppKey && AccessToken == other.AccessToken);
 }
예제 #12
0
 public void Save(IOAuthSource source)
 {
     UpdateManagerProxy.SaveOAuthSource(source, GlobalConstants.ServerWorkspaceID);
 }