public void Startup()
        {
            var tokenUrl = "http://token.asana.com/";
            var anyUrl   = "http://asana.com";


            _restClientMock = new Mock <IRestfulServiceClient>();
            _restClient     = _restClientMock.Object;

            _parametersMock = new Mock <IAsanaParameters>();
            _parametersMock.Setup(x => x.MinutesBeforeTokenRenewal).Returns("10");

            // Url`s setup
            _parametersMock.Setup(x => x.AsanaOAuthTokenUrl).Returns(tokenUrl);
            _parametersMock.Setup(x => x.WorkspacesUrl).Returns(anyUrl);
            _parametersMock.Setup(x => x.UsersInWorkspaceUrl).Returns(anyUrl + "/workspaces");
            _parametersMock.Setup(x => x.UsersMeUrl).Returns(anyUrl + "/me");
            _parametersMock.Setup(x => x.UsersUrl).Returns(anyUrl + "/users");
            _parametersMock.Setup(x => x.TasksUrl).Returns(anyUrl + "/tasks");
            _parametersMock.Setup(x => x.StoriesUrl).Returns(anyUrl + "/stories");

            _parameters = _parametersMock.Object;


            //for token refreshing
            _restClientMock.Setup(
                x => x.PostAsync <JObject>(It.Is <Uri>(y => y.AbsoluteUri.Equals(tokenUrl)),
                                           It.IsAny <HttpContent>(),
                                           It.IsAny <string>(),
                                           It.IsAny <Dictionary <string, string> >()))

            .ReturnsAsync(JObject.Parse(FixtureData.SampleAsanaOauthTokenResponse()));
        }
示例#2
0
 public AsanaOAuthService(IRestfulServiceClient client, IAsanaParameters parameters)
 {
     _restfulClient = client;
     _parameters    = parameters;
     OAuthToken     = new OAuthToken();
     IsIntialized   = false;
 }
示例#3
0
        public AsanaClient(IAsanaParameters parameters, IRestfulServiceClient client)
        {
            Parameters = parameters;

            OAuth            = new AsanaOAuthService(client, Parameters);
            RestCommunicator = new AsanaCommunicatorService(OAuth, client);

            Tasks      = new Tasks(RestCommunicator, Parameters);
            Projects   = new Projects(RestCommunicator, Parameters);
            Stories    = new Stories(RestCommunicator, Parameters);
            Users      = new Users(RestCommunicator, Parameters);
            Workspaces = new Workspaces(RestCommunicator, Parameters);
        }
示例#4
0
 public Stories(IAsanaOAuthCommunicator client, IAsanaParameters asanaParams)
 {
     _restClient  = client;
     _asanaParams = asanaParams;
 }
 public AsanaOAuthBaseActivity(ICrateManager crateManager, IAsanaParameters parameters, IRestfulServiceClient client) : base(crateManager)
 {
     // :( i want dependancy injection here ↓
     AClient = new AsanaClient(parameters, client);
 }
示例#6
0
 public Tasks(IAsanaOAuthCommunicator client, IAsanaParameters parameters)
 {
     _asanaParams = parameters;
     _restClient  = client;
 }
示例#7
0
 public Get_Tasks_v1(ICrateManager crateManager, IRestfulServiceClient client, IAsanaParameters parameters) : base(crateManager, parameters, client)
 {
     DisableValidationOnFollowup = true;
 }
示例#8
0
 public Users(IAsanaOAuthCommunicator client, IAsanaParameters asanaParams)
 {
     _restfulClient = client;
     _asanaParams   = asanaParams;
 }
示例#9
0
 public Post_Comment_v1(ICrateManager crateManager, IAsanaParameters parameters, IRestfulServiceClient client)
     : base(crateManager, parameters, client)
 {
     DisableValidationOnFollowup = true;
 }