public void AcceptArgumentValueInvokesValidator() { _mockValidator.Setup(m => m.Validate("test")).Returns(true).Verifiable(); var parser = new MyParser(null, ParserType.Command, ConverterFactory.CreateOrThrow <string>(), _mockValidator.Object, _mockMapper.Object); parser.ProcessContext(new object(), new ParseContext(Enumerable.Empty <string>())); _mockValidator.Verify(m => m.Validate("test"), Times.Once); }
public void CreateOrThrowForNullableParseTypeDoesNotThrow() { ConverterFactory.CreateOrThrow <byte?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <short?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <int?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <long?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <float?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <double?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <decimal?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <DateTime?>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <TimeSpan?>().ShouldNotBeNull(); }
public void CreateOrThrowForParseTypeDoesNotThrow() { ConverterFactory.CreateOrThrow <byte>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <short>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <int>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <long>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <float>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <double>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <decimal>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <DateTime>().ShouldNotBeNull(); ConverterFactory.CreateOrThrow <TimeSpan>().ShouldNotBeNull(); }
public void AcceptArgumentValueInvokesMapper() { var options = new object(); var parser = new MyParser(null, ParserType.Command, ConverterFactory.CreateOrThrow <string>(), null, _mockMapper.Object); _mockMapper.Setup(m => m.MapValue(options, "test")).Verifiable(); parser.ProcessContext(options, new ParseContext(Enumerable.Empty <string>())); _mockMapper.Verify(m => m.MapValue(options, "test"), Times.Once); }
public void CreateOrThrowForStringDoesNotThrow() { ConverterFactory.CreateOrThrow <string>().ShouldNotBeNull(); }
public void CreateOrThrowForConvertibleTypeDoesNotThrow() { ConverterFactory.CreateOrThrow <ConstructableByString>().ShouldNotBeNull(); }
public void CreateOrThrowForNullableEnumTypeDoesNotThrow() { ConverterFactory.CreateOrThrow <DayOfWeek?>().ShouldNotBeNull(); }
public void CreateOrThrowForUnsupportedTypeThrows() { Should.Throw <ConfigurationException>(() => ConverterFactory.CreateOrThrow <CastConverter <int> >()); }