Beispiel #1
0
        public void Deserialize_StringField()
        {
            var fact = Fact.Create(
                "Skylane.Airline",
                ImmutableList <Field> .Empty.Add(new Field("identifier", new FieldValueString("value"))),
                ImmutableList <Predecessor> .Empty
                );
            var graph   = FactGraph.Empty.Add(fact);
            var airline = Deserialize <Airline>(graph, fact.Reference);

            airline.identifier.Should().Be("value");
        }
Beispiel #2
0
        public void Deserialize_DateField()
        {
            DateTime now  = DateTime.Parse("2021-07-04T01:39:43.241Z");
            var      fact = Fact.Create(
                "Skylane.Airline",
                ImmutableList <Field> .Empty.Add(new Field("identifier", new FieldValueString("value"))),
                ImmutableList <Predecessor> .Empty
                );
            var successor = Fact.Create(
                "Skylane.Airline.Day",
                ImmutableList <Field> .Empty.Add(new Field("date", new FieldValueString(now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ")))),
                ImmutableList <Predecessor> .Empty.Add(new PredecessorSingle("airline", fact.Reference))
                );
            var graph      = FactGraph.Empty.Add(fact).Add(successor);
            var airlineDay = Deserialize <AirlineDay>(graph, successor.Reference);

            airlineDay.date.Kind.Should().Be(DateTimeKind.Utc);
            airlineDay.date.Hour.Should().Be(1);
        }
        public static void Main(string[] args)
        {
            var list = new Dictionary <string, Type>();

            list.Add("x", typeof(string));

            var obj = Fact.Create(list);

            obj._x = "ddd";     // accessing backing field directly works
            string x_ = obj._x; // works

            Console.WriteLine("x_=[{0}]", x_);

            obj.x = "err";    // does not work

            string x = obj.x; // does not work

            Console.WriteLine(x);
        }