Ejemplo n.º 1
0
        public void ClassWithEnumCase()
        {
            Stateable expected = new Stateable(State.Off);

            //using (var stream = new MemoryStream(new byte[16 * 1024], true))
            using (var stream = new FileStream("test.json", FileMode.Create))
            {
                Serializer serializer = new Serializer();
                serializer.Serialize(stream, expected);

                stream.Position = 0;
                Stateable actual = serializer.Deserialize <Stateable>(stream);

                Assert.AreEqual(expected, actual);
            }
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            Stateable _obj = obj as Stateable;

            if (_obj.State != State)
            {
                return(false);
            }

            return(true);
        }