Пример #1
0
        public void UndoChildSuccess()
        {
            UnitTestContext context = GetContext();
            Person          p       = new Person();

            p.Addresses = new AddressList();
            Address a = new Address();

            p.Addresses.Add(a);

            int    age1  = p.Age = 1;
            string city1 = a.City = "one";

            p.BeginEdit();

            int    age2  = p.Age = 2;
            string city2 = a.City = "two";

            a.BeginEdit();

            string city3 = a.City = "three";

            a.CancelEdit();

            context.Assert.AreEqual(age2, p.Age);
            context.Assert.AreEqual(city2, a.City);
            p.CancelEdit();

            context.Assert.AreEqual(age1, p.Age);
            context.Assert.AreEqual(city1, a.City);
            context.Assert.Success();
            context.Complete();
        }
Пример #2
0
        public void UndoParentThenChildEnsureNoEditLevelMismatch()
        {
            using (var context = GetContext())
            {
                Person p = new Person();
                p.Addresses = new AddressList();
                Address a = new Address();
                p.Addresses.Add(a);

                p.BeginEdit();
                a.BeginEdit();
                context.Assert.Try(p.CancelEdit);
            }
        }
Пример #3
0
    public void UndoParentThenChildEnsureNoEditLevelMismatch()
    {
      using (var context = GetContext())
      {
        Person p = new Person();
        p.Addresses = new AddressList();
        Address a = new Address();
        p.Addresses.Add(a);

        p.BeginEdit();
        a.BeginEdit();
        context.Assert.Try(p.CancelEdit);
      }
    }
Пример #4
0
    public void UndoChildSuccess()
    {
      UnitTestContext context = GetContext();
      Person p = new Person();
      p.Addresses = new AddressList();
      Address a = new Address();
      p.Addresses.Add(a);

      int age1 = p.Age = 1;
      string city1 = a.City = "one";
      p.BeginEdit();

      int age2 = p.Age = 2;
      string city2 = a.City = "two";
      a.BeginEdit();

      string city3 = a.City = "three";
      a.CancelEdit();

      context.Assert.AreEqual(age2, p.Age);
      context.Assert.AreEqual(city2, a.City);
      p.CancelEdit();

      context.Assert.AreEqual(age1, p.Age);
      context.Assert.AreEqual(city1, a.City);
      context.Assert.Success();
      context.Complete();
    }