Esempio n. 1
0
        public void AddWorkoutReceiveTest()
        {
            bool bTest1 = false;
            bool bTest2 = false;

            List <string> messageTestList1 = new List <string>();

            messageTestList1.Add("1");
            messageTestList1.Add("1");
            //messageTestList1[1] = "1";

            List <string> messageTestList2 = new List <string>();

            //messageTestList2[1] = "2";
            messageTestList2.Add("2");
            messageTestList2.Add("2");

            SimpleNetwork_Client TCPClient         = ConnectToTCPTest();
            MainContentWindow    mainContentWindow = new MainContentWindow(ref TCPClient, "test", 18);
            RoomManager          roomManager       = new RoomManager(ref TCPClient, mainContentWindow, 18);
            WorkoutManager       workoutManager    = new WorkoutManager(ref TCPClient, mainContentWindow, roomManager);

            if (TCPClient != null)
            {
                //Act
                bTest1 = workoutManager.AddWorkoutReceive(messageTestList1);

                bTest2 = workoutManager.AddWorkoutReceive(messageTestList2);
            }
            //Assert
            Assert.IsTrue(bTest1);
            Assert.IsFalse(bTest2);
        }
Esempio n. 2
0
        public void LoadTest()
        {
            List <Workout> workouts = new List <Workout>();

            workouts = WorkoutManager.Load();
            Assert.AreEqual(4, workouts.Count());
        }
Esempio n. 3
0
    void Awake()
    {
        //PlayerPrefs.DeleteAll ();

        if (Instance == null)
        {
            Instance = this;
        }

        if (PlayerPrefs.GetInt("hasOpenedApp") == 1)
        {
            Load();
        }
        else
        {
            PlayerPrefs.SetString("userTitle", "Workouts");
            PlayerPrefs.SetString("weightType", "lb");
            PlayerPrefs.SetFloat("scanlines", 0.25f);
        }

        Application.runInBackground = true;

        if (PlayerPrefs.GetInt("hasSeenApp") != 1)
        {
            PlayerPrefs.SetInt("hasSeenApp", 1);
        }
    }
Esempio n. 4
0
        // GET: ExerciseController/Create
        public IActionResult Create()
        {
            var types = WorkoutManager.GetAsKeyValuePair();
            var list  = new SelectList(types, "Value", "Text").ToList();

            ViewBag.Workoutid = list;

            return(View());
        }
Esempio n. 5
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        Load();
    }
Esempio n. 6
0
        public void DeleteTest()
        {
            List <Workout>     workouts     = WorkoutManager.Load();
            List <WorkoutType> workoutTypes = WorkoutTypeManager.Load();

            Workout workout = workouts.FirstOrDefault(u => u.WorkoutType == workoutTypes.FirstOrDefault(wt => wt.Name == "Running"));

            int results = WorkoutManager.Delete(workout, true);

            Assert.IsTrue(results > 0);
        }
Esempio n. 7
0
        public void UpdateTest()
        {
            List <Workout>     workouts     = WorkoutManager.Load();
            List <WorkoutType> workoutTypes = WorkoutTypeManager.Load();

            Workout workout = workouts.FirstOrDefault(u => u.WorkoutType == workoutTypes.FirstOrDefault(wt => wt.Name == "Running"));

            workout.EndTime = new DateTime(2020, 11, 19);
            int results = WorkoutManager.Update(workout, true);

            Assert.IsTrue(results > 0);
        }
        public MainContentWindow(ref SimpleNetwork_Client TCPClient, string sUserName, int iUserID)
        {
            InitializeComponent();

            this.sUserName = sUserName;
            this.iUserId   = iUserID;
            this.TCPClient = TCPClient;

            roomManager    = new RoomManager(ref TCPClient, this, iUserID);
            workoutManager = new WorkoutManager(ref TCPClient, this, roomManager);


            lblWelcomeMessage.Content = "Willkommen " + sUserName;
        }
Esempio n. 9
0
        public HttpResponseMessage Get()
        {
            HttpResponseMessage response;

            try
            {
                List <WorkoutItem> result = WorkoutManager.GetAllWorkouts();
                response = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, new StandardResponse(ex));
            }

            return(response);
        }
Esempio n. 10
0
        public HttpResponseMessage WorkoutsByCategory(string category)
        {
            HttpResponseMessage response;

            try
            {
                WorkoutItem workout = WorkoutManager.GetWorkoutByCategory(category);
                response = Request.CreateResponse(HttpStatusCode.OK, workout);
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, new StandardResponse(ex));
            }

            return(response);
        }
Esempio n. 11
0
        public HttpResponseMessage SaveProfile(ProfileItem profile)
        {
            HttpResponseMessage response;

            try
            {
                WorkoutManager.SaveProfile(profile);
                response = Request.CreateResponse(HttpStatusCode.OK, new StandardResponse());
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, new StandardResponse(ex));
            }

            return(response);
        }
Esempio n. 12
0
        public void InsertTest()
        {
            List <WorkoutType> workoutTypes = WorkoutTypeManager.Load();
            List <User>        users        = UserManager.Load();

            Workout workout = new Workout();

            workout.Id          = Guid.NewGuid();
            workout.WorkoutType = workoutTypes.FirstOrDefault(wt => wt.Name == "Running");
            workout.StartTime   = DateTime.Now;
            workout.EndTime     = new DateTime(2020, 11, 18);
            workout.UserId      = users.FirstOrDefault(u => u.FullName == "Leroy Jenkins").Id;

            int results = WorkoutManager.Insert(workout, true);

            Assert.IsTrue(results > 0);
        }
Esempio n. 13
0
        // GET: Workout
        public ActionResult Index()
        {
            User user = (User)Session["User"];

            if (user == null)
            {
                RedirectToAction("Index", "Login");
            }

            WorkoutManager   manager      = new WorkoutManager();
            IList <Exercise> exerciseList = manager.getExercises(user);
            Exercise         ex1          = exerciseList[0];
            Exercise         ex2          = exerciseList[1];
            Exercise         ex3          = exerciseList[2];

            ViewBag.name1   = ex1.Name;
            ViewBag.weight1 = ex1.Weight;
            ViewBag.reps1   = ex1.Reps;
            ViewBag.sets1   = ex1.Sets;

            ViewBag.name2   = ex2.Name;
            ViewBag.weight2 = ex2.Weight;
            ViewBag.reps2   = ex2.Reps;
            ViewBag.sets2   = ex2.Sets;

            ViewBag.name3   = ex3.Name;
            ViewBag.weight3 = ex3.Weight;
            ViewBag.reps3   = ex3.Reps;
            ViewBag.sets3   = ex3.Sets;

            ViewBag.firstName  = user.FirstName;
            ViewBag.lastName   = user.LastName;
            ViewBag.weekNumber = user.CurrentWeek;
            ViewBag.dayNumber  = user.CurrentDay;



            return(View());
        }
Esempio n. 14
0
        public void AddWorkoutSendTest()
        {
            bool bTest1 = false;
            bool bTest2 = false;

            //Arrange not necessary
            SimpleNetwork_Client TCPClient         = ConnectToTCPTest();
            MainContentWindow    mainContentWindow = new MainContentWindow(ref TCPClient, "test", 18);
            RoomManager          roomManager       = new RoomManager(ref TCPClient, mainContentWindow, 18);
            WorkoutManager       workoutManager    = new WorkoutManager(ref TCPClient, mainContentWindow, roomManager);

            if (TCPClient != null)
            {
                //Act
                bTest1 = workoutManager.AddWorkoutSend(2, ";", "Hallo Welt", "http://gehtdichnixan.de/", "WorkoutName", "2", "0");

                bTest2 = workoutManager.AddWorkoutSend(2, ";", "Hallo Welt", "http://gehtdichnixan.de/", "", "2", "0");
            }
            //Assert
            Assert.IsTrue(bTest1);
            Assert.IsFalse(bTest2);
        }
Esempio n. 15
0
 // DELETE api/values/5
 public int Delete([FromBody] Workout value)
 {
     return(WorkoutManager.Delete(value));
 }
Esempio n. 16
0
 void Awake()
 {
     instance = this;
     //Set the path of the database
     connectionString = "URI=file:" + Application.dataPath + "/Database/Database.db";
 }
Esempio n. 17
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        if (PlayerPrefs.GetInt("workout") == 0)
        {
            currentWorkout = pushWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 1)
        {
            currentWorkout = pullWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 2)
        {
            currentWorkout = legsWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 3)
        {
            currentWorkout = chestWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 4)
        {
            currentWorkout = backWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 5)
        {
            currentWorkout = legs2Workout;
        }
        else if (PlayerPrefs.GetInt("workout") == 6)
        {
            currentWorkout = shoulderWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 7)
        {
            currentWorkout = fullWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 8)
        {
            currentWorkout = altWorkout;
        }
        else if (PlayerPrefs.GetInt("workout") == 9)
        {
            currentWorkout = runWorkout;
        }

        //D10
        else if (PlayerPrefs.GetInt("workout") == 10)
        {
            currentWorkout = mon;
        }
        else if (PlayerPrefs.GetInt("workout") == 11)
        {
            currentWorkout = tue;
        }
        else if (PlayerPrefs.GetInt("workout") == 12)
        {
            currentWorkout = wed;
        }
        else if (PlayerPrefs.GetInt("workout") == 13)
        {
            currentWorkout = thu;
        }
        else if (PlayerPrefs.GetInt("workout") == 14)
        {
            currentWorkout = fri;
        }
        else if (PlayerPrefs.GetInt("workout") == 15)
        {
            currentWorkout = sat;
        }
        else if (PlayerPrefs.GetInt("workout") == 16)
        {
            currentWorkout = sun;
        }
    }
Esempio n. 18
0
 // GET api/values
 public IEnumerable <Workout> Get()
 {
     return(WorkoutManager.Load());
 }
Esempio n. 19
0
 // GET api/values/5
 public IEnumerable <Workout> Get(Guid userid)
 {
     return(WorkoutManager.Load(userid));
 }
Esempio n. 20
0
 // POST api/values
 public int Post([FromBody] Workout value)
 {
     return(WorkoutManager.Insert(value));
 }
Esempio n. 21
0
 // PUT api/values/5
 public int Put(int id, [FromBody] Workout value)
 {
     return(WorkoutManager.Update(value));
 }
        // GET: WorkoutController
        public ActionResult Index()
        {
            var workouts = WorkoutManager.GetAll();

            return(View(workouts));
        }