public void GetAllUsers()
        {
            var command = new Command()
                .GetUsers();

            Assert.IsTrue(command.GetStringAndStripRandom() == "/users/");
        }
        public void GetAllOrganizations()
        {
            var command = new Command()
                .GetOrganizations();

            Assert.IsTrue(command.GetStringAndStripRandom() == "/organizations/");
        }
        public void GetMe()
        {
            var command = new Command()
                .GetInformationType(CommandType.Me);

            Assert.IsTrue(command.GetStringAndStripRandom() == "/UserObject.json");
        }
        public void GetDataWithSingleSourceFilter()
        {
            var command = new Command()
                .GetInformationType(CommandType.Fitness)
                    .AddSourceFilter("SingleSource");

            Assert.IsTrue(command.ToString() == "/fitness.json?nocache="+command.NoCache.ToString()+"&source=SingleSource");
        }
        public void GetBulkCommand()
        {
            var command = new Command()
                .FromOrganization("foo")
                .GetInformationType(CommandType.Fitness);

            Assert.IsTrue(command.GetStringAndStripRandom() == "/organizations/foo/fitness.json");
        }
        public void GetASpecificDataFromASpecificUserAtAnOrganization()
        {
            var command = new Command()
                .GetInformationType(CommandType.Tobacco_Cessation)
                .FromUser("bar")
                .FromOrganization("foo");

            Assert.IsTrue(command.GetStringAndStripRandom() == "/organizations/foo/users/bar/tobacco_cessation.json");
        }
 //Enterprise Bulk Data
 public ValidicResult<List<Activity>> GetEnterpriseActivities(string orgId, List<ICommandFilter> filters = null)
 {
     var command = new Command()
         .FromOrganization(orgId);
     if (filters != null) command.Filters = filters;
     var json = PerformCommand(command);
     var userActivities = json.ToResult<List<Activity>>("activities");
     return userActivities;
 }
        public void GetDataWithMultipleSourceFilters()
        {
            var command = new Command()
                .GetInformationType(CommandType.Biometrics)
                    .AddSourceFilter("FirstSource")
                    .AddSourceFilter("SecondSource")
                    .AddSourceFilter("ThirdSource");

            Assert.IsTrue(command.ToString() == "/biometrics.json?nocache=" + command.NoCache.ToString() + "&source=FirstSource SecondSource ThirdSource");
        }
        public ValidicResult<List<Biometrics>> GetEnterpriseBiometricsData(string orgId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Biometrics)
                .FromOrganization(orgId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);

            var biometrics = json.ToResult<List<Biometrics>>();
            return biometrics;
        }
Exemple #10
0
        public List<App> GetEnterpriseApplications(string orgId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Apps)
                .FromOrganization(orgId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);
            var applications = json.Objectify<Apps>().AppCollection;

            return applications;
        }
        public void AppModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Apps)
                .FromUser(UserUnderTest);
            var json = client.PerformCommand(command);
            var applications = json.Objectify<Apps>().AppCollection;

            Assert.IsTrue(applications.Count > 0);
        }
        public void ActivitiesModelPopulatesCorrectly()
        {
            var client = new Client() { AccessToken = "DEMO_KEY" };
            var command = new Command()
                .GetUser(UserUnderTest);

            var json = client.PerformCommand(command);
            var user = json.ToResult<List<Activity>>("activities");

            Assert.IsTrue(user.Object.As<List<Activity>>().Count == 100);
        }
        public void BiometricsModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Biometrics)
                .FromUser(UserUnderTest)
                .FromDate("09-01-01");
            var json = client.PerformCommand(command);

            var biometrics = json.ToResult<List<Biometrics>>();
            Assert.True(biometrics.Object.First()._id != null);
        }
        public void CanAddUser()
        {
            var client = new Client { AccessToken = "563a65efe369f63803fb022d26d549488730bb858be617ab0264d56e4ad3e2c5" };
            var command = new Command()
                .AddUser(new AddUserRequest { access_token = client.AccessToken, user = new UserRequest { uid = MakeRandom().ToString() } })
                .ToOrganization("5238a4616deddaaefc000001");

            var json = client.PerformCommand(command);
            var response = json.Objectify<AddUserResponse>();

            Assert.IsTrue(response.user._id != null);
            Assert.IsTrue(response.code.Equals(201));
        }
 public void FitnessModelPopulatesFromEnterpriseCall()
 {
     var client = new Client { AccessToken = "ENTERPRISE_KEY" };
     var command = new Command()
         .FromOrganization(OrganizationUnderTest)
         .GetInformationType(CommandType.Fitness)
         .GetUser(UserUnderTest);
     var json = client.PerformCommand(command);
     var fitness = json.ToResult<List<Fitness>>();
     Assert.IsTrue(fitness.Object.First()._id != null);
 }
        public void WeightModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Weight)
                .FromUser(UserUnderTest)
                .FromDate("09-01-01");
            var json = client.PerformCommand(command);

            var weight = json.ToResult<List<Weight>>();
            Assert.True(weight.Object.First()._id != null);
        }
        public void TobaccoOrgModelPopulatesCorrectly()
        {
            var client = new Client { AccessToken = "ENTERPRISE_KEY" };
            var command = new Command()
                .GetInformationType(CommandType.Tobacco_Cessation)
                .FromOrganization(OrganizationUnderTest)
                .FromDate("09-01-01");
            var json = client.PerformCommand(command);

            var tobacco = json.ToResult<List<Tobacco_Cessation>>();
            Assert.True(tobacco.Object.First()._id != null);
        }
        public void RoutineModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Routine)
                .FromUser(UserUnderTest);
               var json = client.PerformCommand(command);

               var routine = json.ToResult<List<Routine>>();
               Assert.True(routine.Object.First()._id != null);
        }
        public void ProfileModelPopulatesCorrectly()
        {
            var client = new Client{ AccessToken = "563a65efe369f63803fb022d26d549488730bb858be617ab0264d56e4ad3e2c5" };
            var command = new Command()
                .GetInformationType(CommandType.Profile);

            var json = client.PerformCommand(command);
            var profile = json.ToResult<Profile>();

            Assert.IsTrue(profile.Object.As<Profile>().Gender == GenderType.F);
        }
        public void NutritionModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Nutrition)
                .FromUser(UserUnderTest);
            var json = client.PerformCommand(command);

            var nutrition = json.ToResult<List<Nutrition>>();
            Assert.True(nutrition.Summary.Message.Equals("Ok"));
        }
Exemple #21
0
        public ValidicResult<List<Sleep>> GetUserSleepData(string userId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Sleep)
                .FromUser(userId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);

            var sleep = json.ToResult<List<Sleep>>();

            return sleep;
        }
Exemple #22
0
        public ValidicResult<List<Weight>> GetUserWeightData(string userId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Weight)
                .FromUser(userId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);

            var weight = json.ToResult<List<Weight>>();
            return weight;
        }
        public void FitnessModelPopulatesCorrectly()
        {
            var client = new Client();
            var command = new Command()
                .GetInformationType(CommandType.Fitness)
                .FromUser(UserUnderTest);

            var json = client.PerformCommand(command);
            var fitness = json.ToResult<List<Fitness>>();

            Assert.IsTrue(fitness.Object.As<List<Fitness>>().First().calories != null);
            Assert.IsTrue(fitness.Summary.Status == StatusCode.Ok);
        }
Exemple #24
0
        public ValidicResult<List<Fitness>> GetUserFitnessData(string userId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Fitness)
                .FromUser(userId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);
            var fitness = json.ToResult<List<Fitness>>();

            return fitness;
        }
Exemple #25
0
 public string PerformCommand(Command command)
 {
     return ExecuteWebCommand(command.ToString(), command.Method, command.Payload);
 }
Exemple #26
0
        public ValidicResult<List<Nutrition>> GetUserNutritionData(string userId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Nutrition)
                .FromUser(userId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);

            var nutrition = json.ToResult<List<Nutrition>>();

            return nutrition;
        }
        public void ListOfUsersFromOrganizationParsesCorrectly()
        {
            var client = new Client { AccessToken = "ENTERPRISE_KEY" };
            var command = new Command()
               .GetUsers()
               .FromOrganization(OrganizationUnderTest);
            var json = client.PerformCommand(command);

            var users = json.ToResult<List<Me>>("users");
            Assert.True(users.Object.Count > 0);
        }
        public void MyModelPopultesCorrectly()
        {
            var client = new Client{ AccessToken = "563a65efe369f63803fb022d26d549488730bb858be617ab0264d56e4ad3e2c5" };
            var command = new Command()
                .GetInformationType(CommandType.Me);

            var json = client.PerformCommand(command);
            var me = json.Objectify<Credentials>().me;

            Assert.IsTrue(me.Id == "5238a4c26deddafb51000001");
        }
        public void CanAddUserWithProfile()
        {
            var client = new Client { AccessToken = "563a65efe369f63803fb022d26d549488730bb858be617ab0264d56e4ad3e2c5" };
            //make a user request object
            var newUserWithProfile = new UserRequest {uid = MakeRandom().ToString()};
            //add a profile opbject to the newly created request object
            newUserWithProfile.profile = new Profile { Country = "United States", Gender = GenderType.M, Weight = 125 };
            //create a new command to "add user" and "to organization"
            var command = new Command()
                .AddUser(new AddUserRequest { access_token = client.AccessToken, user = newUserWithProfile })
                .ToOrganization("5238a4616deddaaefc000001");
            //execute the command
            var json = client.PerformCommand(command);
            //deserialize the json into a userresponse object
            var response = json.Objectify<AddUserResponse>();

            Assert.IsTrue(response.user._id != null);
            Assert.IsTrue(response.code.Equals(201));
            Assert.IsTrue(response.user.profile.Gender == GenderType.M);
        }
Exemple #30
0
        public ValidicResult<List<Routine>> GetUserRoutineData(string userId, List<ICommandFilter> filters = null)
        {
            var command = new Command()
                .GetInformationType(CommandType.Routine)
                .FromUser(userId);
            if (filters != null) command.Filters = filters;
            var json = PerformCommand(command);

            var routine = json.ToResult<List<Routine>>();

            return routine;
        }