Exemple #1
0
        public void CreateActivity_AllPropertiesValid_DoesNotThrowArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act and Assert
            Assert.DoesNotThrow(() => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }
Exemple #2
0
        public void CreateActivity_ExerciseSetNotesNull_DoesNotThrowArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivityNew.Exercises.First().Sets.First().Notes = null;
            //Assert
            Assert.DoesNotThrow(() => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }
Exemple #3
0
        public void CreateActivity_ExerciseSecondaryMuscleGroupNotValid_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivityNew.Exercises.First().SecondaryMuscleGroup = "Not a valid muscle group.";
            //Assert
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }
Exemple #4
0
        public void CreateActivity_ExerciseSetEmptyList_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivityNew.Exercises.First().Sets = new List <SetsModel>();
            //Assert
            Assert.AreEqual(0, ValidActivityNew.Exercises.First().Sets.Count);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }
Exemple #5
0
        public void CreateActivity_ExerciseSetNotesTenThousandTwentyFiveCharacters_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());
            //Act
            string charactersCount1025 = string.Empty;

            for (var count = 0; count <= 1024; count++)
            {
                charactersCount1025 += "A";
            }
            ValidActivityNew.Exercises.First().Sets.First().Notes = charactersCount1025;
            //Assert
            Assert.AreEqual(1025, ValidActivityNew.Exercises.First().Sets.First().Notes.Length);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }
Exemple #6
0
        public void CreateActivity_ExerciseRoutineThirtyThreeCharacters_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());
            //Act
            string charactersCount33 = string.Empty;

            for (var count = 0; count <= 32; count++)
            {
                charactersCount33 += "A";
            }
            ValidActivityNew.Exercises.First().Routine = charactersCount33;
            //Assert
            Assert.AreEqual(33, ValidActivityNew.Exercises.First().Routine.Length);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.CreateActivity(ValidActivityNew); });
        }