public void CreateActivity_AllPropertiesValid_DoesNotThrowArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel());
     //Act and Assert
     Assert.DoesNotThrow(() => { activitiesRequest.CreateActivity(ValidActivityNew); });
 }
 public void CreateActivity_TypeNotValid_ArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel());
     //Act
     ValidActivityNew.Type = "Not a valid type.";
     //Assert
     Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
 }
 public void CreateActivity_OnePathItemInArray_ArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel());
     //Act
     ValidActivityNew.Path.RemoveAt(1);
     //Assert
     Assert.AreEqual(1, ValidActivityNew.Path.Count);
     Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
 }
 public ActionResult Activity()
 {
     // Request access to user profile
     var tokenManager = new AccessTokenManager("068e4fe819724d1b94a8889b6a23edbf", "152865a51b9f4b2d80248c5341de6dd5", "http://www.jmckillip.com", "b9be0fab840e458389349bee9ccb6c0a");
     var userRequest = new UsersEndpoint(tokenManager);
     var user = userRequest.GetUser();
     // Get user profile 
     var profileRequest = new ProfileEndpoint(tokenManager, user);
     var profile = profileRequest.GetProfile();
     // Get user name to pass to Activity view via ViewData Dictionary
     ViewData["name"] = profile.Name;
     //Retrieve activities
     var activitiesRequest = new FitnessActivitiesEndpoint(tokenManager, user);
     // Since the feed shows latest first, I only want to get that last one
     var activitiesPage = activitiesRequest.GetFeedPage(null, 1);
     // items[0].Uri will return the URI of the latest activity.
     var items = activitiesPage.Items;
     // Get the latest activity
     var latestActivity = activitiesRequest.GetActivity(items[0].Uri);
     return View(latestActivity);
 }
 public void Init()
 {
     UserRequest = new UsersEndpoint(TokenManager);
     var user = UserRequest.GetUser();
     ActivitiesRequest = new FitnessActivitiesEndpoint(TokenManager, user);
 }
 public void CreateActivity_TypeOtherSecondaryTypeSixtyFiveCharacters_ArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel());
     //Act
     ValidActivityNew.Type = "Other";
     string sixtyFiveCharacterSecondaryType = string.Empty;
     for (var count = 0; count < 65; count++)
     {
         sixtyFiveCharacterSecondaryType += "A";
     }
     ValidActivityNew.SecondaryType = sixtyFiveCharacterSecondaryType;
     //Assert
     Assert.AreEqual(65, ValidActivityNew.SecondaryType.Length);
     Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
 }
 public void UpdateActivity_EquipmentNotValid_ArgumentException()
 {
     //Arrange
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel());
     //Act
     ValidActivity.Equipment = "Not a valid equipment.";
     //Assert
     Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
 }
 public void GetActivity_UriValid_DoesNotThrowArgumentException()
 {
     //Arrange
     var validPath = "/test/";
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel { FitnessActivities = validPath });
     //Act and Assert
     Assert.DoesNotThrow(() => { activitiesRequest.GetActivity(validPath); });
 }
 public void GetActivity_UriNotValid_ArgumentException()
 {
     //Arrange
     var validPath = "/test/";
     Mock<AccessTokenManagerBaseStub> tokenManager = new Mock<AccessTokenManagerBaseStub>();
     FitnessActivitiesEndpoint activitiesRequest = new FitnessActivitiesEndpoint(tokenManager.Object, new UsersModel { FitnessActivities = validPath });
     //Act and Assert
     Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.GetActivity("Not validPath."); });
 }