예제 #1
0
        public void GetAllUsers()
        {
            var command = new Command()
                .GetUsers();

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

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

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

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

            Assert.IsTrue(command.GetStringAndStripRandom() == "/organizations/foo/fitness.json");
        }
예제 #6
0
        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");
        }
예제 #7
0
 //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;
 }
예제 #8
0
        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");
        }
예제 #9
0
        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;
        }
예제 #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;
        }
예제 #11
0
        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);
        }
예제 #12
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);
        }
예제 #13
0
        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);
        }
예제 #14
0
        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));
        }
예제 #15
0
 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);
 }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        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"));
        }
예제 #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;
        }
예제 #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;
        }
예제 #23
0
        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);
        }
예제 #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;
        }
예제 #25
0
 public string PerformCommand(Command command)
 {
     return ExecuteWebCommand(command.ToString(), command.Method, command.Payload);
 }
예제 #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;
        }
예제 #27
0
        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);
        }
예제 #28
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");
        }
예제 #29
0
        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);
        }
예제 #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;
        }