Ejemplo n.º 1
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            BillOfMaterialsModel inserted = new BillOfMaterialsModel();
            inserted.ProductAssemblyID = TestSession.Random.Next();
            inserted.ComponentID       = TestSession.Random.Next();
            inserted.StartDate         = TestSession.Random.RandomDateTime();
            inserted.EndDate           = TestSession.Random.RandomDateTime();
            inserted.UnitMeasureCode   = TestSession.Random.RandomString(3);
            inserted.BOMLevel          = TestSession.Random.RandomShort();
            inserted.PerAssemblyQty    = TestSession.Random.RandomDecimal(8, 2);
            inserted.ModifiedDate      = TestSession.Random.RandomDateTime();

            _tested.Insert(connection, new[] { inserted });

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new BillOfMaterialsModelPrimaryKey()
            {
                BillOfMaterialsID = inserted.BillOfMaterialsID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BillOfMaterialsID, selectedAfterInsert.BillOfMaterialsID);
            Assert.AreEqual(inserted.ProductAssemblyID, selectedAfterInsert.ProductAssemblyID);
            Assert.AreEqual(inserted.ComponentID, selectedAfterInsert.ComponentID);
            Assert.AreEqual(inserted.StartDate, selectedAfterInsert.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterInsert.EndDate);
            Assert.AreEqual(inserted.UnitMeasureCode, selectedAfterInsert.UnitMeasureCode);
            Assert.AreEqual(inserted.BOMLevel, selectedAfterInsert.BOMLevel);
            Assert.AreEqual(inserted.PerAssemblyQty, selectedAfterInsert.PerAssemblyQty);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ProductAssemblyID = TestSession.Random.Next();
            inserted.ComponentID       = TestSession.Random.Next();
            inserted.StartDate         = TestSession.Random.RandomDateTime();
            inserted.EndDate           = TestSession.Random.RandomDateTime();
            inserted.UnitMeasureCode   = TestSession.Random.RandomString(3);
            inserted.BOMLevel          = TestSession.Random.RandomShort();
            inserted.PerAssemblyQty    = TestSession.Random.RandomDecimal(8, 2);
            inserted.ModifiedDate      = TestSession.Random.RandomDateTime();

            _tested.Update(connection, new[] { inserted });

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new BillOfMaterialsModelPrimaryKey()
            {
                BillOfMaterialsID = inserted.BillOfMaterialsID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BillOfMaterialsID, selectedAfterUpdate.BillOfMaterialsID);
            Assert.AreEqual(inserted.ProductAssemblyID, selectedAfterUpdate.ProductAssemblyID);
            Assert.AreEqual(inserted.ComponentID, selectedAfterUpdate.ComponentID);
            Assert.AreEqual(inserted.StartDate, selectedAfterUpdate.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterUpdate.EndDate);
            Assert.AreEqual(inserted.UnitMeasureCode, selectedAfterUpdate.UnitMeasureCode);
            Assert.AreEqual(inserted.BOMLevel, selectedAfterUpdate.BOMLevel);
            Assert.AreEqual(inserted.PerAssemblyQty, selectedAfterUpdate.PerAssemblyQty);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new BillOfMaterialsModelPrimaryKey()
            {
                BillOfMaterialsID = inserted.BillOfMaterialsID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Ejemplo n.º 2
0
        public static void BillOfMaterials(BillOfMaterialsModel table)
        {
            string update = SqliteQuery.Update("BillOfMaterials", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Ejemplo n.º 3
0
        public static void BillOfMaterials(BillOfMaterialsModel table)
        {
            string Delete = SqliteQuery.Delete("BillOfMaterials", table.ID);

            SqliteDataAccess.ExecuteQuery(Delete, table);
        }
Ejemplo n.º 4
0
        public static void BillOfMaterials(BillOfMaterialsModel table)
        {
            string insert = SqliteQuery.Create("BillOfMaterials", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }