Inheritance: IUserProfileBusinessLogic
        public void shouldGetBMI()
        {
            const decimal weight = 73M;
            const decimal length = 183M;
            var userProfile = new UserProfile { Weight = weight, Length = length, User = User };

            var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
            userProfileRepositoryMock.Setup(x => x.GetByUserId(User.Id)).Returns(userProfile);

            var result = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, null, null, null).GetBMI(User);

            var lenghtInMeter = length / 100;
            Assert.That(result, Is.EqualTo(weight / (lenghtInMeter * lenghtInMeter)));
        }
        public void shouldGetDailyCalorieNeed()
        {
            const decimal weight = 83M;
            const int age = 24;
            const int height = 174;
            var gender = new GenderType { Name = "Man" };
            var activityLevel = new ActivityLevelType { Name = "Medel" };
            var calorieCalculator = new Mock<ICalorieCalculator>();

            var userProfile = new UserProfile { Weight = weight, Age = age, Length = height, Gender = gender, ActivityLevel = activityLevel, User = User };

            var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
            userProfileRepositoryMock.Setup(x => x.GetByUserId(User.Id)).Returns(userProfile);

            calorieCalculator.Setup(x => x.GetDailyCalorieNeed(weight, height, age, gender, activityLevel)).Returns(123);

            var result = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, null, null, calorieCalculator.Object).GetDailyCalorieNeed(User);

            Assert.That(result, Is.EqualTo(123));
        }
        public void shouldIfNoGenderExistDefaultMale()
        {
            GenderType expectedGender = null;
            var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
            var userProfile = new UserProfile { Gender = expectedGender, User = User };
            userProfileRepositoryMock.Setup(x => x.GetByUserId(User.Id)).Returns(userProfile);

            var genderTypeBusinessLogic = new Mock<IGenderTypeBusinessLogic>();
            genderTypeBusinessLogic.Setup(x => x.GetGenderType(It.IsAny<string>())).Returns(new GenderType {Name = "Man"});

            var result = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, genderTypeBusinessLogic.Object, null, null).GetGender(User);
            Assert.That(result.Name, Is.EqualTo("Man"));
        }
        public void shouldIfNoActivityLevelExistDefaultLow()
        {
            const string expectedActivityType = "Låg";
            var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
            var activityLevelTypeBusinessLogicMock = new Mock<IActivityLevelTypeBusinessLogic>();

            userProfileRepositoryMock.Setup(x => x.GetByUserId(It.IsAny<int>())).Returns(new UserProfile());
            activityLevelTypeBusinessLogicMock.Setup(x => x.GetActivityLevelType(expectedActivityType)).Returns(new ActivityLevelType{Name = expectedActivityType});

            var result = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, null, activityLevelTypeBusinessLogicMock.Object, null).GetActivityLevel(User);

            activityLevelTypeBusinessLogicMock.VerifyAll();
            Assert.That(result.Name, Is.EqualTo(expectedActivityType));
        }
 public void shouldHaveImplementation()
 {
     var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
     IUserProfileBusinessLogic userProfileBusinessLogic = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, null, null, null);
     Assert.That(userProfileBusinessLogic, Is.Not.Null);
 }
        public void shouldGetZeroAsBMIIfLenghtIsZero()
        {
            const decimal weight = 83M;
            var userProfile = new UserProfile { Weight = weight, Length = 0, User = User };

            var userProfileRepositoryMock = new Mock<IUserProfileRepository>();
            userProfileRepositoryMock.Setup(x => x.GetByUserId(User.Id)).Returns(userProfile);

            var result = new UserProfileBusinessLogic(userProfileRepositoryMock.Object, null, null, null).GetBMI(User);
            Assert.That(result, Is.EqualTo(0));
        }