예제 #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); });
        }
예제 #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); });
        }
예제 #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); });
        }
예제 #4
0
        public void UpdateActivity_ExerciseSetNull_ArgumentException()
        {
            //Arrange
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel());

            //Act
            ValidActivity.Exercises.First().Sets = null;
            //Assert
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.UpdateActivity(ValidActivity); });
        }
예제 #5
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); });
        }
예제 #6
0
        public void DeleteActivityAsync_UriNotValid_ArgumentException()
        {
            //Arrange
            var validPath = "/test/";
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel {
                StrengthTrainingActivities = validPath
            });

            //Act and Assert
            Assert.Throws(typeof(ArgumentException), () => { activitiesRequest.DeleteActivityAsync(() => { }, (ex) => { }, "Not validPath."); });
        }
예제 #7
0
        public void DeleteActivity_UriValid_DoesNotThrowArgumentException()
        {
            //Arrange
            var validPath = "/test/";
            Mock <AccessTokenManagerBaseStub>  tokenManager      = new Mock <AccessTokenManagerBaseStub>();
            StrengthTrainingActivitiesEndpoint activitiesRequest = new StrengthTrainingActivitiesEndpoint(tokenManager.Object, new UsersModel {
                StrengthTrainingActivities = validPath
            });

            //Act and Assert
            Assert.DoesNotThrow(() => { activitiesRequest.DeleteActivity(validPath); });
        }
예제 #8
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); });
        }
예제 #9
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); });
        }