/// <summary> /// Factory for CreateJsonNetJsonSerializer /// </summary> /// <returns>JsonNetJsonSerializer</returns> public static JsonNetJsonSerializer CreateJsonNetJsonSerializer() { var result = new JsonNetJsonSerializer(); // This should fix https://github.com/dapplo/Dapplo.Confluence/issues/41 result.Settings.DateFormatString = result.Settings.DateFormatString.Replace("FFFFFF", "ff"); return(result); }
public void TestLogWork_Serializing() { var started = DateTimeOffset.Now.Subtract(TimeSpan.FromDays(2)); // Make sure we only have millis, ignoring the ticks started = started.AddTicks(-started.Ticks % TimeSpan.TicksPerMillisecond); var worklog = new Worklog { TimeSpentSeconds = (long)TimeSpan.FromHours(16).TotalSeconds, Comment = "Testing the logging of work", Started = started }; var serializer = new JsonNetJsonSerializer(); var json = serializer.Serialize(worklog); Log.Info().WriteLine(json); var deserializedWorklog = (Worklog)serializer.Deserialize(typeof(Worklog), json); Assert.Equal(worklog.Started, deserializedWorklog.Started); }