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."); }