예제 #1
0
		public void CompareTo_OtherHasMoreEntries_ReturnsLess()
		{
			OptionRefCollection reference = new OptionRefCollection(this);
			OptionRefCollection other = new OptionRefCollection(this);
			other.Add("key2");
			Assert.AreEqual(-1, reference.CompareTo(other));
		}
예제 #2
0
		public void CompareTo_OtherHasFewerEntries_ReturnsGreater()
		{
			OptionRefCollection reference = new OptionRefCollection(this);
			reference.Add("key1");
			OptionRefCollection other = new OptionRefCollection(this);
			Assert.AreEqual(1, reference.CompareTo(other));
		}
예제 #3
0
		public void CompareTo_OtherHassameListEntries_ReturnsEqual()
		{
			OptionRefCollection reference = new OptionRefCollection(this);
			reference.Add("key1");
			OptionRefCollection other = new OptionRefCollection(this);
			other.Add("key1");
			Assert.AreEqual(0, reference.CompareTo(other));
		}
예제 #4
0
		public void CompareTo_OtherHasEntrythatIsAlphabeticallyLater_ReturnsLess()
		{
			OptionRefCollection reference = new OptionRefCollection(this);
			reference.Add("key1");
			OptionRefCollection other = new OptionRefCollection(this);
			other.Add("key2");
			Assert.AreEqual(-1, reference.CompareTo(other));
		}
예제 #5
0
        public OptionCollectionControl(OptionRefCollection optionRefCollection,
									   OptionsList list,
									   string idOfPreferredWritingSystem)
        {
            _optionRefCollection = optionRefCollection;
            _list = list;
            _idOfPreferredWritingSystem = idOfPreferredWritingSystem;
            InitializeComponent();
            LoadDisplay();
        }
예제 #6
0
		public void CompareTo_Null_ReturnsGreater()
		{
			OptionRefCollection reference = new OptionRefCollection(this);
			Assert.AreEqual(1, reference.CompareTo(null));
		}
예제 #7
0
		private void WriteOptionRefCollection(string traitName, OptionRefCollection collection)
		{
			if (!ShouldOutputProperty(traitName))
			{
				return;
			}
			foreach (string key in collection.Keys)
			{
				Writer.WriteStartElement("trait");
				Writer.WriteAttributeString("name", traitName);
				Writer.WriteAttributeString("value", key); //yes, the 'value' here is an option key
				Writer.WriteEndElement();
			}
		}
        public void Setup()
        {
            _sourceChoices = new OptionsList();
            AddSourceChoice("one", "1");
            AddSourceChoice("two", "2");
            AddSourceChoice("three", "3");
            AddSourceChoice("four", "4");
            AddSourceChoice("five", "5");

            _chosenItems = new OptionRefCollection(this);

            List<WritingSystem> writingSystems = new List<WritingSystem>();
            writingSystems.Add(_ws);

            _control = new ReferenceCollectionEditor<Option, string, OptionRef>(
                    _chosenItems.Members,
                    _sourceChoices.Options,
                    writingSystems,
                    CommonEnumerations.VisibilitySetting.Visible,
                    new OptionDisplayAdaptor(_sourceChoices, _ws.Id));

            _control.Name = "refcontrol";
            _control.AlternateEmptinessHelper = _chosenItems;
        }