示例#1
0
    public void AddTopic_IsDuplicate_StaysDirty() {

      var relationships         = new NamedTopicCollection("Test");
      var related1              = TopicFactory.Create("Topic", "Page");
      var related2              = TopicFactory.Create("Topic", "Page");

      relationships.Add(related1);

      try {
        relationships.Add(related2);
      }
      catch (ArgumentException) {
        //Expected due to duplicate key
      }

      Assert.IsTrue(relationships.IsDirty);

    }
示例#2
0
    public void AddTopic_IsDirty() {

      var relationships         = new NamedTopicCollection("Test");
      var related               = TopicFactory.Create("Topic", "Page");

      relationships.Add(related);

      Assert.IsTrue(relationships.IsDirty);

    }
示例#3
0
    public void Clear_ExistingTopics_IsDirty() {

      var relationships         = new NamedTopicCollection("Test");
      var related               = TopicFactory.Create("Topic", "Page");

      relationships.Add(related);
      relationships.IsDirty     = false;
      relationships.Clear();

      Assert.IsTrue(relationships.IsDirty);

    }
示例#4
0
    public void RemoveTopic_MissingTopic_StaysDirty() {

      var relationships         = new NamedTopicCollection("Test");
      var related               = TopicFactory.Create("Topic1", "Page");
      var missing               = TopicFactory.Create("Topic2", "Page");

      relationships.Add(related);
      relationships.Remove(missing);

      Assert.IsTrue(relationships.IsDirty);

    }