protected TestBase() { VerifySettings = new VerifySettings(); //VerifySettings.AutoVerify(); VerifySettings.UseDirectory("..\\Verification"); // Ignore and simplify many dynamic properties VerifySettings.IgnoreProperty <SearchMovie>(x => x.VoteCount, x => x.Popularity, x => x.VoteAverage); VerifySettings.SimplifyProperty <SearchMovie>(x => x.BackdropPath, x => x.PosterPath); VerifySettings.SimplifyProperty <SearchPerson>(x => x.ProfilePath); VerifySettings.SimplifyProperty <SearchTvEpisode>(x => x.StillPath); VerifySettings.SimplifyProperty <ImageData>(x => x.FilePath); VerifySettings.SimplifyProperty <SearchCompany>(x => x.LogoPath); VerifySettings.AddExtraSettings(serializerSettings => { serializerSettings.ContractResolver = new DataSortingContractResolver(serializerSettings.ContractResolver); }); WebProxy proxy = null; //WebProxy proxy = new WebProxy("http://127.0.0.1:8888"); TestConfig = new TestConfig(serializer: null, proxy: proxy); }
public Task ScopedSerializer() { var person = new Person { GivenNames = "John", FamilyName = "Smith", }; var settings = new VerifySettings(); settings.AddExtraSettings(_ => _.TypeNameHandling = TypeNameHandling.All); return(Verifier.Verify(person, settings)); }
void ApplyExtraSettingsSample() { #region ExtraSettings var settings = new VerifySettings(); settings.AddExtraSettings(_ => { _.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; _.TypeNameHandling = TypeNameHandling.All; }); #endregion }
public async Task ScopedSerializer() { var person = new Person { GivenNames = "John", FamilyName = "Smith", Dob = new(2000, 10, 1, 0, 0, 0, TimeSpan.Zero), }; var settings = new VerifySettings(); settings.AddExtraSettings(_ => _.TypeNameHandling = TypeNameHandling.All); await Verify(person, settings); }
public async Task ScopedSerializer() { var person = new Person { GivenNames = "John", FamilyName = "Smith", Dob = new DateTimeOffset(2000, 10, 1, 0, 0, 0, TimeSpan.Zero), }; var settings = new VerifySettings(); settings.ModifySerialization(_ => _.DontScrubDateTimes()); settings.AddExtraSettings(_ => _.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat); await Verify(person, settings); }
public void ScopedSerializer() { #region ScopedSerializer var person = new Person { GivenNames = "John", FamilyName = "Smith", Dob = new DateTimeOffset(2000, 10, 1, 0, 0, 0, TimeSpan.Zero), }; var settings = new VerifySettings(); settings.ModifySerialization( _ => _.DontScrubDateTimes()); settings.AddExtraSettings( _ => { _.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; }); #endregion }
public Task TypeNameHandlingAll() { var person = new Person { Id = Guid.NewGuid(), Title = Title.Mr, GivenNames = "John", FamilyName = "Smith", Spouse = "Jill", Children = new List <string> { "Sam", "Mary" }, Address = new Address { Street = "1 Puddle Lane", Country = "USA" } }; var settings = new VerifySettings(); settings.AddExtraSettings(_ => { _.TypeNameHandling = TypeNameHandling.All; }); return(Verify(person, settings)); }