Exemple #1
0
        public void Serialize(Extremum extremum)
        {
            var json = JsonConvert.SerializeObject(extremum);

            var actual = JsonConvert.DeserializeObject <Extremum>(json);

            Assert.NotNull(actual);
            Assert.AreEqual(extremum.GetType(), actual.GetType());
        }
Exemple #2
0
        public void Deserialize(string extremum)
        {
            var      actual   = JsonConvert.DeserializeObject <Extremum>(extremum);
            Extremum expected = extremum.Equals("\"max\"", StringComparison.OrdinalIgnoreCase)
                ? new Maximization() as Extremum
                : new Minimization();

            Assert.NotNull(actual);
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }