예제 #1
0
        public void ParseCorrectly(ModelTestParam <TModel> param)
        {
            Output.WriteLine("Parsing JSON: " + param.Description);
            Output.WriteLine(param.Json);

            var parsed = JsonSerializer.Deserialize <TModel>(param.Json);

            var expected = param.ModifyExpected(Expected);

            Assert.NotNull(expected);
            Assert.NotNull(parsed);
            Compare(expected, parsed);
        }
예제 #2
0
 public ParamBuilder AddTestsFor <TV>(Expression <Func <TModel, IReadOnlyList <TV> > > prop, IReadOnlyList <TV> nonEmptyValue)
 {
     _params.AddRange(ModelTestParam <TModel> .CreateForProperty(_defJson, prop, nonEmptyValue));
     return(this);
 }
예제 #3
0
 public ParamBuilder AddTestsFor(Expression <Func <TModel, DateTime> > prop)
 {
     _params.AddRange(ModelTestParam <TModel> .CreateForProperty(_defJson, prop));
     return(this);
 }
예제 #4
0
 public ParamBuilder AddTestFor(Expression <Func <TModel, object> > prop, object testValue, object expectedValue)
 {
     _params.Add(ModelTestParam <TModel> .CreateExplicit(_defJson, prop, testValue, expectedValue));
     return(this);
 }