示例#1
0
		public bool Equals(LexVariant other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			if (!base.Equals(other)) return false;
			if (!Traits.SequenceEqual(other.Traits)) return false;
			if (!Fields.SequenceEqual(other.Fields)) return false;
			return true;
		}
示例#2
0
		public override IPalasoDataObjectProperty Clone()
		{
			var clone = new LexVariant();
			clone.Traits.AddRange(Traits.Select(t => t.Clone()));
			clone.Fields.AddRange(Fields.Select(f => (LexField)f.Clone()));
			//copied from MultiText
			clone.Forms = Forms.Select(f => (LanguageForm)f.Clone()).ToArray();
			clone.EmbeddedXmlElements = new List<string>(EmbeddedXmlElements);
			return clone;
		}
示例#3
0
        public override IPalasoDataObjectProperty Clone()
        {
            var clone = new LexVariant();

            clone.Traits.AddRange(Traits.Select(t => t.Clone()));
            clone.Fields.AddRange(Fields.Select(f => (LexField)f.Clone()));
            //copied from MultiText
            clone.Forms = Forms.Select(f => (LanguageForm)f.Clone()).ToArray();
            clone.EmbeddedXmlElements = new List <string>(EmbeddedXmlElements);
            return(clone);
        }
示例#4
0
 public bool Equals(LexVariant other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (!base.Equals(other))
     {
         return(false);
     }
     if (!Traits.SequenceEqual(other.Traits))
     {
         return(false);
     }
     if (!Fields.SequenceEqual(other.Fields))
     {
         return(false);
     }
     return(true);
 }
示例#5
0
		public void FieldWithTraits()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var variant = new LexVariant();
				variant.SetAlternative("etr", "one");
				var fieldA = new LexField("a");
				fieldA.SetAlternative("en", "aaa");
				fieldA.Traits.Add(new LexTrait("one", "1"));
				variant.Fields.Add(fieldA);
				session.LiftWriter.AddVariant(variant);
				session.LiftWriter.End();
				AssertHasOneMatch("variant/field[@type='a']/trait[@name='one' and @value='1']", session);
			}
		}
示例#6
0
		public void VariantWith2SimpleFields()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var variant = new LexVariant();
				variant.SetAlternative("etr", "one");
				var fieldA = new LexField("a");
				fieldA.SetAlternative("en", "aaa");
				variant.Fields.Add(fieldA);
				var fieldB = new LexField("b");
				fieldB.SetAlternative("en", "bbb");
				variant.Fields.Add(fieldB);
				session.LiftWriter.AddVariant(variant);
				session.LiftWriter.End();
				AssertHasOneMatch("variant/field[@type='a']/form[@lang='en' and text = 'aaa']", session);
				AssertHasOneMatch("variant/field[@type='b']/form[@lang='en' and text = 'bbb']", session);
			}
		}
示例#7
0
		public void VariantWith2Traits()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var variant = new LexVariant();
				variant.SetAlternative("etr", "one");
				variant.Traits.Add(new LexTrait("a", "A"));
				variant.Traits.Add(new LexTrait("b", "B"));
				session.LiftWriter.AddVariant(variant);
				session.LiftWriter.End();
				AssertHasOneMatch("variant/trait[@name='a' and @value='A']", session);
				AssertHasOneMatch("variant/trait[@name='b' and @value='B']", session);
			}
		}
示例#8
0
		public void EntryWith2SimpleVariants()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var e = session.CreateItem();
				var variant = new LexVariant();
				variant.SetAlternative("etr","one");
				e.Variants.Add(variant);
				variant = new LexVariant();
				variant.SetAlternative("etr", "two");
				e.Variants.Add(variant);
				session.LiftWriter.Add(e);
				session.LiftWriter.End();
				AssertHasOneMatch("entry/variant/form[@lang='etr' and text='one']", session);
				AssertHasOneMatch("entry/variant/form[@lang='etr' and text='two']", session);
			}
		}