public void CanParseReturnsExpectedResultWhenValueIsWellKnown()
        {
            var value  = _knownValues[new Random().Next(0, _knownValues.Length)];
            var result = NationalRoadNumber.CanParse(value);

            Assert.True(result);
        }
        public void CanParseReturnsExpectedResultWhenValueIsUnknown()
        {
            var value  = _fixture.Create <string>();
            var result = NationalRoadNumber.CanParse(value);

            Assert.False(result);
        }
        public void ParseReturnsExpectedResultWhenValueIsWellKnown()
        {
            _fixture.Customizations.Add(
                new FiniteSequenceGenerator <string>(_knownValues));
            var value = _fixture.Create <string>();

            Assert.NotNull(NationalRoadNumber.Parse(value));
        }
        public void ToStringReturnsExpectedResult()
        {
            var value  = _knownValues[new Random().Next(0, _knownValues.Length)];
            var sut    = NationalRoadNumber.Parse(value);
            var result = sut.ToString();

            Assert.Equal(value, result);
        }
        public void TryParseReturnsExpectedResultWhenValueIsUnknown()
        {
            var value  = new Generator <string>(_fixture).First(candidate => !_knownValues.Contains(candidate));
            var result = NationalRoadNumber.TryParse(value, out NationalRoadNumber parsed);

            Assert.False(result);
            Assert.Null(parsed);
        }
        public void TryParseReturnsExpectedResultWhenValueIsWellKnown()
        {
            var value  = _knownValues[new Random().Next(0, _knownValues.Length)];
            var result = NationalRoadNumber.TryParse(value, out NationalRoadNumber parsed);

            Assert.True(result);
            Assert.NotNull(parsed);
            Assert.Equal(value, parsed.ToString());
        }
 public void TryParseValueCanNotBeNull()
 {
     Assert.Throws <ArgumentNullException>(() => NationalRoadNumber.TryParse(null, out _));
 }
        public void ParseReturnsExpectedResultWhenValueIsUnknown()
        {
            var value = _fixture.Create <string>();

            Assert.Throws <FormatException>(() => NationalRoadNumber.Parse(value));
        }