public void GetLongestMagicNumber_NoMagicNumberDefined_Negative() { // Arrange var magicNumber = new MagicNumberMapping(); // Act Action act = () => magicNumber.GetLongestMagicNumber(); // Assert act.Should().Throw <InvalidConfigurationException>("there are no magic numbers defined at all, hence no longest number"); }
public void GetLongestMagicNumber_Positive() { // Arrange var longestMagicNumberToAdd = 10; var fileMagicNumberMapping = new MagicNumberMapping(); for (var i = 1; i <= longestMagicNumberToAdd; i++) { var magicNumber = Enumerable.Repeat(new byte?(1), i).ToArray(); var type = i.ToString(); fileMagicNumberMapping.AddMagicNumber(magicNumber, type); } // Act var longestMagicNumber = fileMagicNumberMapping.GetLongestMagicNumber(); // Assert longestMagicNumber.Should().Be(longestMagicNumberToAdd); }