Пример #1
0
        public void UpdateActivity_AllPropertiesValid_DoesNotThrowArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act and Assert
            Assert.DoesNotThrow(() => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
Пример #2
0
        public void UpdateActivity_ExerciseSetNotesNull_DoesNotThrowArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivity.Exercises.First().Sets.First().Notes = null;
            //Assert
            Assert.DoesNotThrow(() => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
Пример #3
0
        public void UpdateActivity_ExerciseSecondaryMuscleGroupNotValid_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivity.Exercises.First().SecondaryMuscleGroup = "Not a valid muscle group.";
            //Assert
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
Пример #4
0
        public void UpdateActivity_ExerciseSetEmptyList_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivity.Exercises.First().Sets = new List <SetsModel>();
            //Assert
            Assert.AreEqual(0, ValidActivity.Exercises.First().Sets.Count);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
Пример #5
0
        public void UpdateActivity_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";
            }
            ValidActivity.Exercises.First().Sets.First().Notes = charactersCount1025;
            //Assert
            Assert.AreEqual(1025, ValidActivity.Exercises.First().Sets.First().Notes.Length);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
Пример #6
0
        public void UpdateActivity_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";
            }
            ValidActivity.Exercises.First().Routine = charactersCount33;
            //Assert
            Assert.AreEqual(33, ValidActivity.Exercises.First().Routine.Length);
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
        }