示例#1
0
 ///<summary>
 ///  Update the Typed MercLocation Entity with modified mock values.
 ///</summary>
 static public void UpdateMockInstance_Generated(TransactionManager tm, MercLocation mock)
 {
     mock.StkId   = TestUtility.Instance.RandomString(5, false);;
     mock.LocId   = TestUtility.Instance.RandomString(4, false);;
     mock.GoodsId = TestUtility.Instance.RandomString(6, false);;
     mock.Check   = TestUtility.Instance.RandomBoolean();
 }
示例#2
0
        /// <summary>
        /// Deep load all MercLocation children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.MercLocationProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.MercLocationProvider.DeepLoading += new EntityProviderBaseCore <MercLocation, MercLocationKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.MercLocationProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("MercLocation instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.MercLocationProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
示例#3
0
        ///<summary>
        ///  Update the Typed MercLocation Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, MercLocation mock)
        {
            MercLocationTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
示例#4
0
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                MercLocation entity = CreateMockInstance(tm);
                bool         result = DataRepository.MercLocationProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");
            }
        }
示例#5
0
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                MercLocation entity = mock.Copy() as MercLocation;
                entity = (MercLocation)mock.Clone();
                Assert.IsTrue(MercLocation.ValueEquals(entity, mock), "Clone is not working");
            }
        }
示例#6
0
        ///<summary>
        ///  Returns a Typed MercLocation Entity with mock values.
        ///</summary>
        static public MercLocation CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            MercLocation mock = MercLocationTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
示例#7
0
        /// <summary>
        /// Serialize the mock MercLocation entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_MercLocation.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
示例#8
0
        /// <summary>
        /// Inserts a mock MercLocation entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.MercLocationProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.MercLocationProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
示例#9
0
        /// <summary>
        /// Serialize a MercLocation collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_MercLocationCollection.xml");

                mock = CreateMockInstance(tm);
                TList <MercLocation> mockCollection = new TList <MercLocation>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<MercLocation> correctly serialized to a temporary file.");
            }
        }
示例#10
0
        ///<summary>
        ///  Returns a Typed MercLocation Entity with mock values.
        ///</summary>
        static public MercLocation CreateMockInstance_Generated(TransactionManager tm)
        {
            MercLocation mock = new MercLocation();

            mock.StkId   = TestUtility.Instance.RandomString(5, false);;
            mock.LocId   = TestUtility.Instance.RandomString(4, false);;
            mock.GoodsId = TestUtility.Instance.RandomString(6, false);;
            mock.Check   = TestUtility.Instance.RandomBoolean();


            // create a temporary collection and add the item to it
            TList <MercLocation> tempMockCollection = new TList <MercLocation>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((MercLocation)mock);
        }
示例#11
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                MercLocation mock   = CreateMockInstance(tm);
                bool         result = DataRepository.MercLocationProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                MercLocationQuery query = new MercLocationQuery();

                query.AppendEquals(MercLocationColumn.Idx, mock.Idx.ToString());
                query.AppendEquals(MercLocationColumn.StkId, mock.StkId.ToString());
                query.AppendEquals(MercLocationColumn.LocId, mock.LocId.ToString());
                query.AppendEquals(MercLocationColumn.GoodsId, mock.GoodsId.ToString());
                query.AppendEquals(MercLocationColumn.Check, mock.Check.ToString());

                TList <MercLocation> results = DataRepository.MercLocationProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
示例#12
0
 /// <summary>
 /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
 /// </summary>
 /// <param name="mock">Object to be modified</param>
 static private void SetSpecialTestData(MercLocation mock)
 {
     //Code your changes to the data object here.
 }