public void SettingNullValues() { var sut = new Configuration(); Assert.Throws<ArgumentNullException>(() => sut.SetCulture(null)); Assert.Throws<ArgumentNullException>(() => sut.SetIndentIncrement(null)); Assert.Throws<ArgumentNullException>(() => sut.SetNewlineDefinition(null)); Assert.Throws<ArgumentNullException>(() => sut.SetOutputFormatter(null)); Assert.Throws<ArgumentNullException>(() => sut.SetAreEqualsMethod(null)); Assert.Throws<ArgumentNullException>(() => sut.Add((IFieldHarvester)null)); Assert.Throws<ArgumentNullException>(() => sut.Add((IValueConverter)null)); Assert.Throws<ArgumentNullException>(() => sut.Test.SetAreEqualsMethod(null)); Assert.Throws<ArgumentNullException>(() => sut.Test.SetAutomaticTestRewrite(null)); }
public void TryFind() { var config = new Configuration(); config.Add(new StandardTypesConverter(null)); IValueConverter h; Assert.IsTrue(config.TryGetValueConverter(typeof(decimal), out h)); Assert.IsTrue(h is StandardTypesConverter); }
/// <summary> /// Return a configuration which covers most usages. /// The configuration returned can be further remolded by adding additional handlers. /// /// Eg. add a <see cref="PublicFieldsHarvester"/> to restrict the printed state to only public fields. /// </summary> public static Configuration GetStandardConfiguration( string indentIncrement = Configuration.DefaultIndention, TestFrameworkAreEqualsMethod areEqualsMethod = null) { var cfg = new Configuration(indentIncrement, areEqualsMethod); // valueconverters cfg.Add(new StandardTypesConverter(cfg)); cfg.Add(new StringConverter()); cfg.Add(new DateTimeConverter(cfg)); cfg.Add(new EnumConverter()); // harvesters cfg.Add(new AllFieldsHarvester()); // outputformatters cfg.OutputFormatter = new CurlyBraceStyle(cfg); return(cfg); }