public void JsonSerialiser_WriteObject_Writes_ValueTypes_Correctly_For_Non_UK_Cultures() { var worksheet = new ExcelWorksheetData(TestContext); foreach (var culture in new string[] { "en-US", "de-DE", "fr-FR", "ru-RU" }) { using (var cultureSwitcher = new CultureSwitcher(culture)) { TestCleanup(); TestInitialise(); var obj = new ValueTypes() { BoolValue = worksheet.Bool("BoolValue"), UnusedBool = worksheet.Bool("UnusedBool"), NullableBool = worksheet.NBool("NullableBool"), Int = worksheet.Int("Int"), NullableInt = worksheet.NInt("NullableInt"), Long = worksheet.Long("Long"), NullableLong = worksheet.NLong("NullableLong"), Float = worksheet.Float("Float"), NullableFloat = worksheet.NFloat("NullableFloat"), Double = worksheet.Double("Double"), NullableDouble = worksheet.NDouble("NullableDouble"), DateTime = worksheet.DateTime("DateTime"), NullableDateTime = worksheet.NDateTime("NullableDateTime"), }; _JsonSerialiser.Initialise(typeof(ValueTypes)); _JsonSerialiser.WriteObject(_Stream, obj); var message = String.Format("when culture is {0}", culture); Assert.AreEqual(worksheet.EString("Json"), GetJson(), message); } } }
public void JsonSerialiser_WriteObject_Writes_ValueTypes_Correctly() { var worksheet = new ExcelWorksheetData(TestContext); var obj = new ValueTypes() { BoolValue = worksheet.Bool("BoolValue"), UnusedBool = worksheet.Bool("UnusedBool"), NullableBool = worksheet.NBool("NullableBool"), Int = worksheet.Int("Int"), NullableInt = worksheet.NInt("NullableInt"), Long = worksheet.Long("Long"), NullableLong = worksheet.NLong("NullableLong"), Float = worksheet.Float("Float"), NullableFloat = worksheet.NFloat("NullableFloat"), Double = worksheet.Double("Double"), NullableDouble = worksheet.NDouble("NullableDouble"), DateTime = worksheet.DateTime("DateTime"), NullableDateTime = worksheet.NDateTime("NullableDateTime"), }; _JsonSerialiser.Initialise(typeof(ValueTypes)); _JsonSerialiser.WriteObject(_Stream, obj); Assert.AreEqual(worksheet.EString("Json"), GetJson()); }
public void JsonSerialiser_WriteObject_Writes_ValueTypes_Correctly_For_Non_UK_Cultures() { var worksheet = new ExcelWorksheetData(TestContext); foreach(var culture in new string[] { "en-US", "de-DE", "fr-FR", "ru-RU" }) { using(var cultureSwitcher = new CultureSwitcher(culture)) { TestCleanup(); TestInitialise(); var obj = new ValueTypes() { BoolValue = worksheet.Bool("BoolValue"), UnusedBool = worksheet.Bool("UnusedBool"), NullableBool = worksheet.NBool("NullableBool"), Int = worksheet.Int("Int"), NullableInt = worksheet.NInt("NullableInt"), Long = worksheet.Long("Long"), NullableLong = worksheet.NLong("NullableLong"), Float = worksheet.Float("Float"), NullableFloat = worksheet.NFloat("NullableFloat"), Double = worksheet.Double("Double"), NullableDouble = worksheet.NDouble("NullableDouble"), DateTime = worksheet.DateTime("DateTime"), NullableDateTime = worksheet.NDateTime("NullableDateTime"), }; _JsonSerialiser.Initialise(typeof(ValueTypes)); _JsonSerialiser.WriteObject(_Stream, obj); var message = String.Format("when culture is {0}", culture); Assert.AreEqual(worksheet.EString("Json"), GetJson(), message); } } }