Exemplo n.º 1
0
    public void DCEditLevels()
    {
      DCRoot root = new DCRoot();
      root.BeginEdit();
      root.Data = 123;
      root.CancelEdit();

      Assert.AreEqual(0, root.Data, "Data should be 0");

      root.BeginEdit();
      root.Data = 123;
      root.ApplyEdit();

      Assert.AreEqual(123, root.Data, "Data should be 123");
    }
Exemplo n.º 2
0
    public void DCClone()
    {
      System.Configuration.ConfigurationManager.AppSettings["CslaSerializationFormatter"] =
        "NetDataContractSerializer";
      Assert.AreEqual(
        Csla.ApplicationContext.SerializationFormatters.NetDataContractSerializer,
        Csla.ApplicationContext.SerializationFormatter,
        "Formatter should be NetDataContractSerializer");

      DCRoot root = new DCRoot();
      root.Data = 123;
      DCRoot clone = root.Clone();

      Assert.IsFalse(ReferenceEquals(root, clone), "Object instance should be different");
      Assert.AreEqual(root.Data, clone.Data, "Data should match");
      Assert.IsTrue(root.IsDirty, "Root IsDirty should be true");
      Assert.IsTrue(clone.IsDirty, "Clone IsDirty should be true");
    }
Exemplo n.º 3
0
        public void DCEditLevels()
        {
            IDataPortal <DCRoot> dataPortal = _testDIContext.CreateDataPortal <DCRoot>();

            DCRoot root = DCRoot.NewDCRoot(dataPortal);

            root.BeginEdit();
            root.Data = 123;
            root.CancelEdit();

            Assert.AreEqual(0, root.Data, "Data should be 0");

            root.BeginEdit();
            root.Data = 123;
            root.ApplyEdit();

            Assert.AreEqual(123, root.Data, "Data should be 123");
        }
Exemplo n.º 4
0
    public void DCEditLevels()
    {
      System.Configuration.ConfigurationManager.AppSettings["CslaSerializationFormatter"] =
        "NetDataContractSerializer";
      Assert.AreEqual(
        Csla.ApplicationContext.SerializationFormatters.NetDataContractSerializer,
        Csla.ApplicationContext.SerializationFormatter,
        "Formatter should be NetDataContractSerializer");

      DCRoot root = new DCRoot();
      root.BeginEdit();
      root.Data = 123;
      root.CancelEdit();

      Assert.AreEqual(0, root.Data, "Data should be 0");

      root.BeginEdit();
      root.Data = 123;
      root.ApplyEdit();

      Assert.AreEqual(123, root.Data, "Data should be 123");
    }
Exemplo n.º 5
0
        public void DCClone()
        {
            IDataPortal <DCRoot> dataPortal = _testDIContext.CreateDataPortal <DCRoot>();

            System.Configuration.ConfigurationManager.AppSettings["CslaSerializationFormatter"] =
                "NetDataContractSerializer";
            // TODO: NDCS has been dropped I think; is there a way to replicate this test with another formatter?
            //Assert.AreEqual(
            //  Csla.ApplicationContext.SerializationFormatters.NetDataContractSerializer,
            //  Csla.ApplicationContext.SerializationFormatter,
            //  "Formatter should be NetDataContractSerializer");

            DCRoot root = DCRoot.NewDCRoot(dataPortal);

            root.Data = 123;
            DCRoot clone = root.Clone();

            Assert.IsFalse(ReferenceEquals(root, clone), "Object instance should be different");
            Assert.AreEqual(root.Data, clone.Data, "Data should match");
            Assert.IsTrue(root.IsDirty, "Root IsDirty should be true");
            Assert.IsTrue(clone.IsDirty, "Clone IsDirty should be true");
        }