public HabitServiceTests()
        {
            this.InitializeMapper();
            this.habitsRepository = new Mock <IDeletableEntityRepository <Habit> >();

            var enumParseService = new EnumParseService();

            this.dateTimeService = new Mock <IDateTimeService>();
            this.habitService    = new HabitService(this.habitsRepository.Object, this.dateTimeService.Object, enumParseService);
        }
        public void Parse_WithIncorrectData_ShouldThrowArgumentException()
        {
            // Arrange
            var stringFormatServiceMock = this.GetStringFormatServiceMock();
            var enumParseService        = new EnumParseService(stringFormatServiceMock.Object);

            // Act

            // Assert
            Assert.Throws <ArgumentException>(() => enumParseService.Parse <Period>("Incorrect"));
        }
        public void Parse_WithCorrectData_ShouldReturnCorrectResult()
        {
            var errorMessagePrefix = "EnumParseService Parse<TEnum>() method does not work properly.";

            // Arrange
            var stringFormatServiceMock = this.GetStringFormatServiceMock();
            var enumParseService        = new EnumParseService(stringFormatServiceMock.Object);

            // Act
            var actualResult   = enumParseService.Parse <Period>("A La Minute");
            var expectedResult = Period.ALaMinute;

            // Assert
            Assert.True(expectedResult == actualResult, errorMessagePrefix + " " + "Enum is not returned properly.");
        }
        public void GetEnumDescription_WithIncorrectData_ShouldReturnCorrectResult()
        {
            var errorMessagePrefix = "EnumParseService GetEnumDescription() method does not work properly.";

            // Arrange
            var stringFormatServiceMock = this.GetStringFormatServiceMock();
            var enumParseService        = new EnumParseService(stringFormatServiceMock.Object);

            // Act
            string actualResult = enumParseService
                                  .GetEnumDescription("Incorrect", typeof(Period));
            string expectedResult = null;

            // Assert
            Assert.True(expectedResult == actualResult, errorMessagePrefix + " " + "Result is not null.");
        }
        public void GetEnumDescription_WithCorrectData_ShouldReturnCorrectResult()
        {
            var errorMessagePrefix = "EnumParseService GetEnumDescription() method does not work properly.";

            // Arrange
            var stringFormatServiceMock = this.GetStringFormatServiceMock();
            var enumParseService        = new EnumParseService(stringFormatServiceMock.Object);

            // Act
            var actualResult = enumParseService
                               .GetEnumDescription(Period.ALaMinute.ToString(), typeof(Period));
            var expectedResult = "A La Minute";

            // Assert
            Assert.True(expectedResult == actualResult, errorMessagePrefix + " " + "Description is not returned properly.");
        }