Ejemplo n.º 1
0
    public void GetValueTest()
    {
        VcfRow row  = VcfRow.Parse("Profile:", new VcfDeserializationInfo()) !;
        var    prop = new ProfileProperty(row, VCdVersion.V3_0);

        Assert.AreEqual("VCARD", prop.Value);
    }
Ejemplo n.º 2
0
    public void OrganizationPropertyTest3()
    {
        VcfRow row  = VcfRow.Parse("ORG:", new VcfDeserializationInfo()) !;
        var    prop = new OrganizationProperty(row, Enums.VCdVersion.V3_0);

        Assert.IsNotNull(prop.Value);
    }
Ejemplo n.º 3
0
    public void DataPropertyTest3()
    {
        VcfRow row  = VcfRow.Parse("PHOTO:", new VcfDeserializationInfo()) !;
        var    prop = new DataProperty(row, VCdVersion.V3_0);

        Assert.IsNull(prop.Value);
    }
Ejemplo n.º 4
0
    public void NamePropertyTest3()
    {
        VcfRow row  = VcfRow.Parse("FN:", new VcfDeserializationInfo()) !;
        var    prop = new NameProperty(row, VCdVersion.V3_0);

        Assert.IsNotNull(prop.Value);
    }
    public void StringCollectionPropertyTest3(string s, string?expectedGroup, string[]?expectedNickNames)
    {
        var vcfRow = VcfRow.Parse(s, new VcfDeserializationInfo());

        Assert.IsNotNull(vcfRow);

        var nickNameProp = new StringCollectionProperty(vcfRow !, Enums.VCdVersion.V4_0);

        Assert.AreEqual(expectedGroup, nickNameProp.Group);
        CollectionAssert.AreEqual(expectedNickNames, nickNameProp.Value);
    }
    public void GetValueTest()
    {
        VcfRow row  = VcfRow.Parse("PidMap:", new VcfDeserializationInfo()) !;
        var    prop = new PropertyIDMappingProperty(row);

        Assert.IsNull(prop.Value);

        //using var writer = new StringWriter();
        //var serializer = new Vcf_3_0Serializer(writer, VcfOptions.WriteEmptyProperties, null);
        //serializer.
        //prop.BuildProperty(serializer);
        //Assert.AreEqual(0, writer.ToString().Length);
    }
Ejemplo n.º 7
0
    public void GenderPropertyTest2(string s, string?expectedGroup, VCdSex?expectedSex, string?expectedGenderIdentity)
    {
        var vcfRow = VcfRow.Parse(s, new VcfDeserializationInfo());

        Assert.IsNotNull(vcfRow);

        var genderProp = new GenderProperty(vcfRow !, Enums.VCdVersion.V4_0);

        Assert.IsNotNull(genderProp.Value);
        Assert.AreEqual(expectedGroup, genderProp.Group);
        Assert.AreEqual(expectedSex, genderProp.Value.Sex);
        Assert.AreEqual(expectedGenderIdentity, genderProp.Value.GenderIdentity);
    }
Ejemplo n.º 8
0
    public void OrganizationPropertyTest2(
        string s, string?expectedGroup, string?expectedOrganizationName, string[] expectedOrganizationalUnits)
    {
        var vcfRow = VcfRow.Parse(s, new VcfDeserializationInfo());

        Assert.IsNotNull(vcfRow);

        var orgProp = new OrganizationProperty(vcfRow !, Enums.VCdVersion.V4_0);

        Assert.IsNotNull(orgProp.Value);
        Assert.AreEqual(expectedGroup, orgProp.Group);
        Assert.AreEqual(expectedOrganizationName, orgProp.Value.OrganizationName);
        CollectionAssert.AreEqual(expectedOrganizationalUnits, orgProp.Value.OrganizationalUnits);
    }
Ejemplo n.º 9
0
    public void AccessPropertyTest2()
    {
        var row = VcfRow.Parse($"{GROUP}.{VCard.PropKeys.CLASS}:private", new VcfDeserializationInfo());

        Assert.IsNotNull(row);

        var prop = new AccessProperty(row !);

        Assert.AreEqual(GROUP, prop.Group);
        Assert.AreEqual(Enums.VCdAccess.Private, prop.Value);
        Assert.AreEqual(Enums.VCdAccess.Private, ((VCardProperty)prop).Value);


        Assert.IsFalse(prop.IsEmpty);
    }
Ejemplo n.º 10
0
    public void ParseTest(string input, bool rowIsNull, string key, string?group, int parametersCount)
    {
        var info = new VcfDeserializationInfo();

        _ = info.Builder.Append(input);
        var row = VcfRow.Parse(info.Builder.ToString(), info);

        if (rowIsNull)
        {
            Assert.IsNull(row);
            return;
        }

        Assert.IsNotNull(row);
        Assert.IsNotNull(row !.Parameters);
        Assert.AreEqual(parametersCount, row.Parameters.Count);
        Assert.AreEqual(key, row.Key, false);
        Assert.AreEqual(group, row.Group, false);
    }