//[TestCase] //public void CorrectlySerializesToJsonStringWithInvariantCulture() //{ // TestSerializationUsingCulture(CultureInfo.InvariantCulture); //} //[TestCase] //public void CorrectlySerializesToJsonStringWithDutchCulture() //{ // TestSerializationUsingCulture(new CultureInfo("nl-NL")); //} //[TestCase] //public void CorrectlySerializesToJsonStringWithCustomCulture() //{ // var cultureInfo = new CultureInfo("en-US", true); // cultureInfo.DateTimeFormat = new DateTimeFormatInfo // { // } // TestSerializationUsingCulture(cultureInfo); //} private void TestSerializationUsingCulture(CultureInfo culture) { var testModel = new TestModel(); var currentDateTime = DateTime.Now; testModel.DateTimeProperty = currentDateTime; var configuration = new SerializationConfiguration { Culture = culture }; var json = testModel.ToJson(configuration); Assert.IsTrue(json.Contains(currentDateTime.ToString(culture))); }
public void CorrectlySerializesToJsonString() { var testModel = new TestModel(); testModel._excludedField = "excluded"; testModel._includedField = "included"; testModel.ExcludedRegularProperty = "excluded"; testModel.IncludedRegularProperty = "included"; testModel.ExcludedCatelProperty = "excluded"; testModel.IncludedCatelProperty = "included"; var json = testModel.ToJson(); Assert.IsFalse(json.Contains("Excluded")); }