Esempio n. 1
0
    public async Task Model_Serialization()
    {
        var sut = new Model("Test");

        sut.Fields.Add(new Field("Field1"));

        var idx = new Index();

        idx.Fields.Add(new IndexField("Field1"));
        sut.Indexes.Add(idx);

        var rel = new Relationship()
        {
            PrincipalModel = new Name("Test"),
            PrincipalType  = RelationshipTypes.One,
            DependantModel = new Name("OtherModel"),
            DependantType  = RelationshipTypes.Many
        };

        rel.PrincipalFields.Add(new Name("Field1"));
        rel.DependantFields.Add(new Name("OtherField"));
        sut.Relationships.Add(rel);

        var json = sut.ToJson();

        await Verifier.VerifyJson(json);

        var actual = json.FromJson <Model>();

        actual.Should().BeEquivalentTo(sut);
    }
Esempio n. 2
0
 public static SqlServerIndex SqlServer(this Index index, Model model)
 => new SqlServerIndex(model, index);
Esempio n. 3
0
 public SqlServerIndex(Model model, Index index)
 {
     _model = model;
     _index = index;
 }