public void CreateWidget_Single_Empty() { RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); }
public void CreateWidget_Many() { RelationController.CreateWidget(_source, _synonymsRelationType, _synonymsRelationField, _lexEntryRepository, delegate { }); }
public void NoWritingSystemsEnabledOnField_ThrowsConfigurationException() { _singleSynonymRelationField.WritingSystemIds.Clear(); Assert.Throws <ConfigurationException>(() => RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { })); }
public void CreateWidget_Single_ExistingEmpty() { AddRelation(_source, _singleSynonymRelationField.FieldName, string.Empty); RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); }
public void CreateWidget_Single_ExistingRelationToExistantRecord_ControlDisplaysLexicalUnit() { AddRelation(_source, _singleSynonymRelationField.FieldName, _target.Id); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); Assert.AreEqual(_target.LexicalForm[WritingSystemsIdsForTests.OtherIdForTest], c.Text); }
public void CreateWidget_Single_ExistingRelationToNonExistantRecord_ControlDisplaysId() { AddRelation(_source, _singleSynonymRelationField.FieldName, "NonExistantId"); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); Assert.AreEqual("NonExistantId", c.Text); }
public void ChangeBoundRelation_Single_Existing() { LexRelation relation = AddRelation(_source, _singleSynonymRelationField.FieldName, "something"); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); c.Text = _target.LexicalForm[WritingSystemsIdsForTests.OtherIdForTest]; Assert.AreEqual(_target.Id, relation.Key); }
public void ChangeBoundRelation_Single_ToNonExistant_NoRelation() { LexRelation relation = AddRelation(_source, _singleSynonymRelationField.FieldName, _target.Id); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); c.Text = "NonExistantId"; Assert.AreEqual(string.Empty, relation.Key); }
public void TriggerFindApproximate_Single() { AddRelation(_source, _singleSynonymRelationField.FieldName, _target.Id); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); Form form = new Form(); form.Controls.Add(c); AutoCompleteWithCreationBox <RecordToken <LexEntry>, string> picker = (AutoCompleteWithCreationBox <RecordToken <LexEntry>, string>)c; ((WeSayAutoCompleteTextBox)(picker.Box)).Paste("text"); }
public void ChangeBoundRelation_Single_ToNonExistantCreate_CreatesRelation() { LexRelation relation = AddRelation(_source, _singleSynonymRelationField.FieldName, _target.Id); Control c = RelationController.CreateWidget(_source, _singleSynonymRelationType, _singleSynonymRelationField, _lexEntryRepository, delegate { }); c.Text = "new"; AutoCompleteWithCreationBox <RecordToken <LexEntry>, string> picker = (AutoCompleteWithCreationBox <RecordToken <LexEntry>, string>)c; picker.CreateNewObjectFromText(); LexEntry newEntry = _lexEntryRepository.GetLexEntryWithMatchingId(relation.Key); Assert.IsNotNull(newEntry); Assert.AreEqual("new", newEntry.LexicalForm[WritingSystemsIdsForTests.OtherIdForTest]); }