Esempio n. 1
0
        public void TestStructWithFields()
        {
            var data = new StructWithFields {
                x = 10, y = 2
            };
            var json  = NetJSON.Serialize(data);
            var data2 = NetJSON.Deserialize <StructWithFields>(json);

            Assert.AreEqual(data.x, data.x);
            Assert.AreEqual(data.y, data.y);
        }
Esempio n. 2
0
        public void ValueReturnsCopyOfInputForValueType()
        {
            var inputValue = new StructWithFields
            {
                foo = 12
            };

            var result = Optional.Of(inputValue);

            result.HasValue.Should().BeTrue();
            result.Value.Should().BeEquivalentTo(inputValue);
        }
        public void ConvertsEmptyStructToNonEmptyOptional()
        {
            Optional <StructWithFields> result = new StructWithFields();

            result.HasValue.Should().BeTrue();
        }