// ---------------------------------------------------------------------------------------- /// <!-- EndemeAccess_PrependEndeme_tests --> /// <summary> /// /// </summary> private void EndemeAccess_PrependEndeme_tests() { Assert.ThingsAbout("EndemeAccess", "PrependEndeme"); // -------------------------------------------------------------------------- // Educe set // -------------------------------------------------------------------------- Guid setID = EndemeAccess.GetEndemeSetID("Animal", connection, trx); EndemeSet enSet = null; if (setID == Guid.Empty) { EndemeAccess.InsertEndemeSet(EndemeTests.WetlandAnimals, connection, trx); } else { enSet = EndemeAccess.GetEndemeSet(setID, connection, trx); } // -------------------------------------------------------------------------- // Test prepend // -------------------------------------------------------------------------- Endeme en1 = new Endeme(enSet, "ABCD"); Guid id1 = EndemeAccess.InsertEndeme(en1, connection, trx); Endeme en2 = new Endeme(enSet, "MOUSE"); Guid id2 = EndemeTableFactory_old.PrependEndeme_old(en2, id1, connection, trx); Endeme en3 = EndemeAccess.GetEndeme(id2, connection, trx); Assert.That(en3.ToString(), Is.equal_to, "MOUSEABCD"); _result += Assert.Conclusion; }
// ---------------------------------------------------------------------------------------- /// <!-- EndemeAccess_HappyPath_tests --> /// <summary> /// Methods used as intended, no null, empty or border tests /// </summary> /// <remarks></remarks> private void EndemeAccess_HappyPath_tests() { string toEndemeTable = "Endeme"; Assert.ThingsAbout("EndemeAccess", "HappyPath"); InfoAspect aspect = new InfoAspect("Test", null, "", "", "", 0); EndemeAccess e = new EndemeAccess(); EndemeSet enSet1 = EndemeTests.WetlandAnimals; Guid setID1 = Guid.NewGuid(); int didOk1 = e.ToteEndemeSet(enSet1.WithId(setID1), connection, trx); Guid setID2 = e.GetEndemeSetId(enSet1.Label, connection, trx); EndemeSet enSet2 = e.OnEndemeSet(setID2, connection, trx); Endeme en1 = new Endeme(enSet2, "ABC", true); long endemeId = e.ToEndeme(en1, toEndemeTable, connection, trx); Endeme en2 = e.GetEndeme(endemeId, toEndemeTable, connection, trx); Endeme en3 = en2.Copy(); en3.Add("DEF"); int status = e.UpdateEndeme(en3, endemeId, toEndemeTable, aspect); Assert.That(setID2, Is.equal_to, setID1); Assert.That(enSet2.Count, Is.equal_to, 22); Assert.That(enSet2.Label, Is.equal_to, enSet1.Label); Assert.That(en2.ToString(), Is.equal_to, en1); Assert.That(en3.ToString(), Is.equal_to, "ABCDEF"); Assert.That(enSet1.SetId, Is.not_equal_to, Guid.Empty); _result += Assert.Conclusion; }
public Guid Subscribe(Concept observer, string label, EndemeSet enSetRelationship, Endeme enRelationship, EndemeSet enSet, Endeme en) { // -------------------------------------------------------------------------- // Most Concepts will be added to the Observer list // -------------------------------------------------------------------------- EndemeItem standard = new EndemeItem(null); if (standard.ItemKey == Guid.Empty) { throw new Exception("boom"); } if (enRelationship.Count > 1 || !enRelationship.Contains('L')) { standard = Observer.Add(label, enSetRelationship, enRelationship, observer); } if (standard.ItemKey == Guid.Empty) { throw new Exception("boom"); } // -------------------------------------------------------------------------- // A few Concepts will be added to the Friend list // -------------------------------------------------------------------------- if (enRelationship.Contains('L')) { EndemeItem friend = Friend.Add(label, enSet, en, observer); Observer.ChangeGuid(friend.ItemKey, standard.ItemKey); } return(standard.ItemKey); }
public Concept UnSubscribe(Guid observerId, EndemeSet enSetRelationship, Endeme enRelationship) { // -------------------------------------------------------------------------- // Simple removal if it is in the Friend list // -------------------------------------------------------------------------- if (enRelationship.Contains('L')) { EndemeItem item = Friend[observerId]; Friend.Remove(observerId); } // -------------------------------------------------------------------------- // More complex if the relationship is not just friendship // -------------------------------------------------------------------------- if (enRelationship.Count > 1 || !enRelationship.Contains('L')) { EndemeItem item = Observer[observerId]; if (item.EnSet.Label == enSetRelationship.Label) { item.ItemEndeme -= enRelationship; // will this really work? if (item.ItemEndeme.Count < 1) { Observer.Remove(observerId); } } else { throw new InvalidOperationException("This should always be true, the endeme set should always match"); } } return(this); }
// ---------------------------------------------------------------------------------------- /// <!-- ToEndeme --> /// <summary> /// /// </summary> /// <returns></returns> public Endeme ToEndeme() { Endeme en = new Endeme(); if (Keys().Count <= 24) { Dictionary <char, string> keyLetters = new Dictionary <char, string>(); // build a set by getting a letter for every key EndemeSet set = new EndemeSet("Tally", Keys()); // TODO: write this - build the endeme } return(en); }
// ---------------------------------------------------------------------------------------- /// <!-- EndemeAccess_HappyPath_tests --> /// <summary> /// Methods used as intended, no null, empty or border tests /// </summary> /// <remarks></remarks> private void EndemeAccess_HappyPath_tests() { Assert.ThingsAbout("EndemeAccess", "HappyPath"); EndemeSet enSet1 = EndemeTests.WetlandAnimals; Guid setID1 = EndemeAccess.InsertEndemeSet(enSet1, connection, trx); Guid setID2 = EndemeAccess.GetEndemeSetID(enSet1.Label, connection, trx); EndemeSet enSet2 = EndemeAccess.GetEndemeSet(setID2, connection, trx); Endeme en1 = new Endeme(enSet2, "ABC"); Guid enID = EndemeAccess.InsertEndeme(en1, connection, trx); Endeme en2 = EndemeAccess.GetEndeme(enID, connection, trx); Endeme en3 = en2.Copy(); en3.Add("DEF"); int status = EndemeAccess.UpdateEndeme(en3, enID, connection, trx); Assert.That(setID2, Is.equal_to, setID1); Assert.That(enSet2.Count, Is.equal_to, 22); Assert.That(enSet2.Label, Is.equal_to, enSet1.Label); Assert.That(en2.ToString(), Is.equal_to, en1.ToString()); Assert.That(en3.ToString(), Is.equal_to, "ABCDEF"); Assert.That(enSet1.SetId, Is.not_equal_to, Guid.Empty); _result += Assert.Conclusion; }
// ---------------------------------------------------------------------------------------- // IConceptSource Interface implementation // ---------------------------------------------------------------------------------------- /// <summary> /// Implements a method of IConceptSource (similar to IObservable) /// </summary> /// <returns></returns> public Guid Subscribe(Concept observer, string label, EndemeSet enSetRelationship, Endeme enRelationship) { EndemeItem item = Observer.Add(label, enSetRelationship, enRelationship, observer, true); return(item.ItemKey); }
private static EndemeSet _relationship = null; //ABCDEFGHIJKLMNOPQRSTUV| /// <summary>In SOA when you cache someConcept in a static variable you may need to add this refresh to the application refresh code</summary> public static void RefreshRelationshipEndemeSet() { _relationship = null; }
} // In SOA when you cache something in a static variable you may need to add this to the application refresh code public static Guid MentalCharacteristics_insert(InfoAspect aspect) { _mind = null; return(new EndemeAccess().ToteEndemeSet(MentalCharacteristics.WithId(Guid.NewGuid()), aspect.SecondaryConn)); }
public static EndemeSet MentalCharacteristics_refresh( ) { _mind = null; return(MentalCharacteristics); } // In SOA when you cache something in a static variable you may need to add this to the application refresh code
public static int MentalCharacteristics_update(InfoAspect aspect) { _mind = null; return(new EndemeAccess().ReUpEndemeSet(MentalCharacteristics.WithId(MentalCharacteristics_id(aspect)), aspect)); }