public void Gets_two_exercises_successfully() { // Arrange IUser user = UserFactory.GetUser(); IExerciseDAL dal = ExerciseDALFactory.GetExerciseDAL(); IUserCollection userCollection = UserCollectionFactory.GetUserCollection(); ExerciseDTO legextension = new ExerciseDTO(Guid.NewGuid(), "TempLegExtension", userID, ExerciseTypeDTO.Weighted); ExerciseDTO pushup = new ExerciseDTO(Guid.NewGuid(), "TempPushup", userID, ExerciseTypeDTO.Bodyweight); dal.AddExercise(legextension); dal.AddExercise(pushup); // Act ExerciseDTO legextensionDTO = userCollection.GetExercise("TempLegextension"); ExerciseDTO pushupDTO = userCollection.GetExercise("TempPushup"); // Assert Assert.AreEqual(userID, legextensionDTO.UserID); Assert.AreEqual(ExerciseTypeDTO.Weighted, legextensionDTO.ExerciseType); Assert.AreEqual("TempLegextension", legextensionDTO.Name); Assert.AreEqual(legextension.ExerciseID, legextensionDTO.ExerciseID); Assert.AreEqual(userID, pushupDTO.UserID); Assert.AreEqual(ExerciseTypeDTO.Bodyweight, pushupDTO.ExerciseType); Assert.AreEqual("TempPushup", pushupDTO.Name); Assert.AreEqual(pushup.ExerciseID, pushupDTO.ExerciseID); }
//methods public void AddExercise(ExerciseDTO exercise) { IExerciseDAL dal = ExerciseDALFactory.GetExerciseDAL(); ExerciseDTO exerciseToAdd = new ExerciseDTO(Guid.NewGuid(), exercise.Name, exercise.UserID, exercise.ExerciseType); dal.AddExercise(exerciseToAdd); }
public void Get_Exercise_By_ID() { //arrange IUser user = UserFactory.GetUser(); IExerciseDAL dal = ExerciseDALFactory.GetExerciseDAL(); ExerciseDTO tempExercise = new ExerciseDTO(Guid.NewGuid(), "TempSquat", userID, ExerciseTypeDTO.Weighted); dal.AddExercise(tempExercise); //act ExerciseDTO exerciseDTO = user.GetExercise(tempExercise.ExerciseID.ToString()); //assert Assert.AreEqual("TempSquat", exerciseDTO.Name); Assert.AreEqual(tempExercise.ExerciseID, exerciseDTO.ExerciseID); Assert.AreEqual(ExerciseTypeDTO.Weighted, exerciseDTO.ExerciseType); Assert.AreEqual(userID, exerciseDTO.UserID); }
public void Get_Exercise_By_Name() { //arrange IUserCollection userCollection = UserCollectionFactory.GetUserCollection(); IExerciseDAL dal = ExerciseDALFactory.GetExerciseDAL(); Guid exerciseID = Guid.NewGuid(); ExerciseDTO tempExercise = new ExerciseDTO(exerciseID, "TempDeadlift", userID, ExerciseTypeDTO.Weighted); dal.AddExercise(tempExercise); //act ExerciseDTO TempDeadliftDTO = userCollection.GetExercise("TempDeadlift"); //assert Assert.AreEqual("TempDeadlift", TempDeadliftDTO.Name); Assert.AreEqual(exerciseID, TempDeadliftDTO.ExerciseID); Assert.AreEqual(ExerciseTypeDTO.Weighted, TempDeadliftDTO.ExerciseType); Assert.AreEqual(userID, TempDeadliftDTO.UserID); }