Example #1
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ProductInventoryModel inserted = new ProductInventoryModel();
            inserted.ProductID    = TestSession.Random.Next();
            inserted.LocationID   = TestSession.Random.RandomShort();
            inserted.Shelf        = TestSession.Random.RandomString(10);
            inserted.Bin          = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.Quantity     = TestSession.Random.RandomShort();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ProductInventoryModelPrimaryKey()
            {
                ProductID  = inserted.ProductID,
                LocationID = inserted.LocationID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.LocationID, selectedAfterInsert.LocationID);
            Assert.AreEqual(inserted.Shelf, selectedAfterInsert.Shelf);
            Assert.AreEqual(inserted.Bin, selectedAfterInsert.Bin);
            Assert.AreEqual(inserted.Quantity, selectedAfterInsert.Quantity);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.Shelf        = TestSession.Random.RandomString(10);
            inserted.Bin          = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.Quantity     = TestSession.Random.RandomShort();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ProductInventoryModelPrimaryKey()
            {
                ProductID  = inserted.ProductID,
                LocationID = inserted.LocationID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.LocationID, selectedAfterUpdate.LocationID);
            Assert.AreEqual(inserted.Shelf, selectedAfterUpdate.Shelf);
            Assert.AreEqual(inserted.Bin, selectedAfterUpdate.Bin);
            Assert.AreEqual(inserted.Quantity, selectedAfterUpdate.Quantity);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ProductInventoryModelPrimaryKey()
            {
                ProductID  = inserted.ProductID,
                LocationID = inserted.LocationID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            DocumentModel inserted = new DocumentModel();
            inserted.DocumentNode    = Microsoft.SqlServer.Types.SqlHierarchyId.Null; //TODO define how to generate random hierarchy id in test session;
            inserted.DocumentLevel   = TestSession.Random.RandomShort();
            inserted.Title           = TestSession.Random.RandomString(50);
            inserted.Owner           = TestSession.Random.Next();
            inserted.FolderFlag      = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.FileName        = TestSession.Random.RandomString(400);
            inserted.FileExtension   = TestSession.Random.RandomString(8);
            inserted.Revision        = TestSession.Random.RandomString(5);
            inserted.ChangeNumber    = TestSession.Random.Next();
            inserted.Status          = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.DocumentSummary = TestSession.Random.RandomString(-1);
            inserted.Document        = TestSession.Random.RandomBytes();
            inserted.rowguid         = Guid.NewGuid();
            inserted.ModifiedDate    = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new DocumentModelPrimaryKey()
            {
                DocumentNode = inserted.DocumentNode,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.DocumentNode, selectedAfterInsert.DocumentNode);
            Assert.AreEqual(inserted.DocumentLevel, selectedAfterInsert.DocumentLevel);
            Assert.AreEqual(inserted.Title, selectedAfterInsert.Title);
            Assert.AreEqual(inserted.Owner, selectedAfterInsert.Owner);
            Assert.AreEqual(inserted.FolderFlag, selectedAfterInsert.FolderFlag);
            Assert.AreEqual(inserted.FileName, selectedAfterInsert.FileName);
            Assert.AreEqual(inserted.FileExtension, selectedAfterInsert.FileExtension);
            Assert.AreEqual(inserted.Revision, selectedAfterInsert.Revision);
            Assert.AreEqual(inserted.ChangeNumber, selectedAfterInsert.ChangeNumber);
            Assert.AreEqual(inserted.Status, selectedAfterInsert.Status);
            Assert.AreEqual(inserted.DocumentSummary, selectedAfterInsert.DocumentSummary);
            Assert.AreEqual(inserted.Document, selectedAfterInsert.Document);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.DocumentLevel   = TestSession.Random.RandomShort();
            inserted.Title           = TestSession.Random.RandomString(50);
            inserted.Owner           = TestSession.Random.Next();
            inserted.FolderFlag      = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.FileName        = TestSession.Random.RandomString(400);
            inserted.FileExtension   = TestSession.Random.RandomString(8);
            inserted.Revision        = TestSession.Random.RandomString(5);
            inserted.ChangeNumber    = TestSession.Random.Next();
            inserted.Status          = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.DocumentSummary = TestSession.Random.RandomString(-1);
            inserted.Document        = TestSession.Random.RandomBytes();
            inserted.rowguid         = Guid.NewGuid();
            inserted.ModifiedDate    = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new DocumentModelPrimaryKey()
            {
                DocumentNode = inserted.DocumentNode,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.DocumentNode, selectedAfterUpdate.DocumentNode);
            Assert.AreEqual(inserted.DocumentLevel, selectedAfterUpdate.DocumentLevel);
            Assert.AreEqual(inserted.Title, selectedAfterUpdate.Title);
            Assert.AreEqual(inserted.Owner, selectedAfterUpdate.Owner);
            Assert.AreEqual(inserted.FolderFlag, selectedAfterUpdate.FolderFlag);
            Assert.AreEqual(inserted.FileName, selectedAfterUpdate.FileName);
            Assert.AreEqual(inserted.FileExtension, selectedAfterUpdate.FileExtension);
            Assert.AreEqual(inserted.Revision, selectedAfterUpdate.Revision);
            Assert.AreEqual(inserted.ChangeNumber, selectedAfterUpdate.ChangeNumber);
            Assert.AreEqual(inserted.Status, selectedAfterUpdate.Status);
            Assert.AreEqual(inserted.DocumentSummary, selectedAfterUpdate.DocumentSummary);
            Assert.AreEqual(inserted.Document, selectedAfterUpdate.Document);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new DocumentModelPrimaryKey()
            {
                DocumentNode = inserted.DocumentNode,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            PersonPhoneModel inserted = new PersonPhoneModel();
            inserted.BusinessEntityID  = TestSession.Random.Next();
            inserted.PhoneNumber       = TestSession.Random.RandomString(25);
            inserted.PhoneNumberTypeID = TestSession.Random.Next();
            inserted.ModifiedDate      = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new PersonPhoneModelPrimaryKey()
            {
                BusinessEntityID  = inserted.BusinessEntityID,
                PhoneNumber       = inserted.PhoneNumber,
                PhoneNumberTypeID = inserted.PhoneNumberTypeID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.PhoneNumber, selectedAfterInsert.PhoneNumber);
            Assert.AreEqual(inserted.PhoneNumberTypeID, selectedAfterInsert.PhoneNumberTypeID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new PersonPhoneModelPrimaryKey()
            {
                BusinessEntityID  = inserted.BusinessEntityID,
                PhoneNumber       = inserted.PhoneNumber,
                PhoneNumberTypeID = inserted.PhoneNumberTypeID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.PhoneNumber, selectedAfterUpdate.PhoneNumber);
            Assert.AreEqual(inserted.PhoneNumberTypeID, selectedAfterUpdate.PhoneNumberTypeID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new PersonPhoneModelPrimaryKey()
            {
                BusinessEntityID  = inserted.BusinessEntityID,
                PhoneNumber       = inserted.PhoneNumber,
                PhoneNumberTypeID = inserted.PhoneNumberTypeID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            SalesPersonModel inserted = new SalesPersonModel();
            inserted.BusinessEntityID = TestSession.Random.Next();
            inserted.TerritoryID      = TestSession.Random.Next();
            inserted.SalesQuota       = TestSession.Random.RandomDecimal();
            inserted.Bonus            = TestSession.Random.RandomDecimal();
            inserted.CommissionPct    = Convert.ToDecimal(TestSession.Random.Next());
            inserted.SalesYTD         = TestSession.Random.RandomDecimal();
            inserted.SalesLastYear    = TestSession.Random.RandomDecimal();
            inserted.rowguid          = Guid.NewGuid();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new SalesPersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterInsert.TerritoryID);
            Assert.AreEqual(inserted.SalesQuota, selectedAfterInsert.SalesQuota);
            Assert.AreEqual(inserted.Bonus, selectedAfterInsert.Bonus);
            Assert.AreEqual(inserted.CommissionPct, selectedAfterInsert.CommissionPct);
            Assert.AreEqual(inserted.SalesYTD, selectedAfterInsert.SalesYTD);
            Assert.AreEqual(inserted.SalesLastYear, selectedAfterInsert.SalesLastYear);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.TerritoryID   = TestSession.Random.Next();
            inserted.SalesQuota    = TestSession.Random.RandomDecimal();
            inserted.Bonus         = TestSession.Random.RandomDecimal();
            inserted.CommissionPct = Convert.ToDecimal(TestSession.Random.Next());
            inserted.SalesYTD      = TestSession.Random.RandomDecimal();
            inserted.SalesLastYear = TestSession.Random.RandomDecimal();
            inserted.rowguid       = Guid.NewGuid();
            inserted.ModifiedDate  = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new SalesPersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterUpdate.TerritoryID);
            Assert.AreEqual(inserted.SalesQuota, selectedAfterUpdate.SalesQuota);
            Assert.AreEqual(inserted.Bonus, selectedAfterUpdate.Bonus);
            Assert.AreEqual(inserted.CommissionPct, selectedAfterUpdate.CommissionPct);
            Assert.AreEqual(inserted.SalesYTD, selectedAfterUpdate.SalesYTD);
            Assert.AreEqual(inserted.SalesLastYear, selectedAfterUpdate.SalesLastYear);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new SalesPersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ProductListPriceHistoryModel inserted = new ProductListPriceHistoryModel();
            inserted.ProductID    = TestSession.Random.Next();
            inserted.StartDate    = TestSession.Random.RandomDateTime();
            inserted.EndDate      = TestSession.Random.RandomDateTime();
            inserted.ListPrice    = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ProductListPriceHistoryModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
                StartDate = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.StartDate, selectedAfterInsert.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterInsert.EndDate);
            Assert.AreEqual(inserted.ListPrice, selectedAfterInsert.ListPrice);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.EndDate      = TestSession.Random.RandomDateTime();
            inserted.ListPrice    = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ProductListPriceHistoryModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
                StartDate = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.StartDate, selectedAfterUpdate.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterUpdate.EndDate);
            Assert.AreEqual(inserted.ListPrice, selectedAfterUpdate.ListPrice);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ProductListPriceHistoryModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
                StartDate = inserted.StartDate,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ProductModelProductDescriptionCultureModel inserted = new ProductModelProductDescriptionCultureModel();
            inserted.ProductModelID       = TestSession.Random.Next();
            inserted.ProductDescriptionID = TestSession.Random.Next();
            inserted.CultureID            = TestSession.Random.RandomString(6);
            inserted.ModifiedDate         = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ProductModelProductDescriptionCultureModelPrimaryKey()
            {
                ProductModelID       = inserted.ProductModelID,
                ProductDescriptionID = inserted.ProductDescriptionID,
                CultureID            = inserted.CultureID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ProductModelID, selectedAfterInsert.ProductModelID);
            Assert.AreEqual(inserted.ProductDescriptionID, selectedAfterInsert.ProductDescriptionID);
            Assert.AreEqual(inserted.CultureID, selectedAfterInsert.CultureID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ProductModelProductDescriptionCultureModelPrimaryKey()
            {
                ProductModelID       = inserted.ProductModelID,
                ProductDescriptionID = inserted.ProductDescriptionID,
                CultureID            = inserted.CultureID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ProductModelID, selectedAfterUpdate.ProductModelID);
            Assert.AreEqual(inserted.ProductDescriptionID, selectedAfterUpdate.ProductDescriptionID);
            Assert.AreEqual(inserted.CultureID, selectedAfterUpdate.CultureID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ProductModelProductDescriptionCultureModelPrimaryKey()
            {
                ProductModelID       = inserted.ProductModelID,
                ProductDescriptionID = inserted.ProductDescriptionID,
                CultureID            = inserted.CultureID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #7
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            SalesTerritoryHistoryModel inserted = new SalesTerritoryHistoryModel();
            inserted.BusinessEntityID = TestSession.Random.Next();
            inserted.TerritoryID      = TestSession.Random.Next();
            inserted.StartDate        = TestSession.Random.RandomDateTime();
            inserted.EndDate          = TestSession.Random.RandomDateTime();
            inserted.rowguid          = Guid.NewGuid();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new SalesTerritoryHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                TerritoryID      = inserted.TerritoryID,
                StartDate        = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterInsert.TerritoryID);
            Assert.AreEqual(inserted.StartDate, selectedAfterInsert.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterInsert.EndDate);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.EndDate      = TestSession.Random.RandomDateTime();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new SalesTerritoryHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                TerritoryID      = inserted.TerritoryID,
                StartDate        = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterUpdate.TerritoryID);
            Assert.AreEqual(inserted.StartDate, selectedAfterUpdate.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterUpdate.EndDate);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new SalesTerritoryHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                TerritoryID      = inserted.TerritoryID,
                StartDate        = inserted.StartDate,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            WorkOrderRoutingModel inserted = new WorkOrderRoutingModel();
            inserted.WorkOrderID        = TestSession.Random.Next();
            inserted.ProductID          = TestSession.Random.Next();
            inserted.OperationSequence  = TestSession.Random.RandomShort();
            inserted.LocationID         = TestSession.Random.RandomShort();
            inserted.ScheduledStartDate = TestSession.Random.RandomDateTime();
            inserted.ScheduledEndDate   = TestSession.Random.RandomDateTime();
            inserted.ActualStartDate    = TestSession.Random.RandomDateTime();
            inserted.ActualEndDate      = TestSession.Random.RandomDateTime();
            inserted.ActualResourceHrs  = TestSession.Random.RandomDecimal();
            inserted.PlannedCost        = TestSession.Random.RandomDecimal();
            inserted.ActualCost         = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate       = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new WorkOrderRoutingModelPrimaryKey()
            {
                WorkOrderID       = inserted.WorkOrderID,
                ProductID         = inserted.ProductID,
                OperationSequence = inserted.OperationSequence,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.WorkOrderID, selectedAfterInsert.WorkOrderID);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.OperationSequence, selectedAfterInsert.OperationSequence);
            Assert.AreEqual(inserted.LocationID, selectedAfterInsert.LocationID);
            Assert.AreEqual(inserted.ScheduledStartDate, selectedAfterInsert.ScheduledStartDate);
            Assert.AreEqual(inserted.ScheduledEndDate, selectedAfterInsert.ScheduledEndDate);
            Assert.AreEqual(inserted.ActualStartDate, selectedAfterInsert.ActualStartDate);
            Assert.AreEqual(inserted.ActualEndDate, selectedAfterInsert.ActualEndDate);
            Assert.AreEqual(inserted.ActualResourceHrs, selectedAfterInsert.ActualResourceHrs);
            Assert.AreEqual(inserted.PlannedCost, selectedAfterInsert.PlannedCost);
            Assert.AreEqual(inserted.ActualCost, selectedAfterInsert.ActualCost);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.LocationID         = TestSession.Random.RandomShort();
            inserted.ScheduledStartDate = TestSession.Random.RandomDateTime();
            inserted.ScheduledEndDate   = TestSession.Random.RandomDateTime();
            inserted.ActualStartDate    = TestSession.Random.RandomDateTime();
            inserted.ActualEndDate      = TestSession.Random.RandomDateTime();
            inserted.ActualResourceHrs  = TestSession.Random.RandomDecimal();
            inserted.PlannedCost        = TestSession.Random.RandomDecimal();
            inserted.ActualCost         = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate       = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new WorkOrderRoutingModelPrimaryKey()
            {
                WorkOrderID       = inserted.WorkOrderID,
                ProductID         = inserted.ProductID,
                OperationSequence = inserted.OperationSequence,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.WorkOrderID, selectedAfterUpdate.WorkOrderID);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.OperationSequence, selectedAfterUpdate.OperationSequence);
            Assert.AreEqual(inserted.LocationID, selectedAfterUpdate.LocationID);
            Assert.AreEqual(inserted.ScheduledStartDate, selectedAfterUpdate.ScheduledStartDate);
            Assert.AreEqual(inserted.ScheduledEndDate, selectedAfterUpdate.ScheduledEndDate);
            Assert.AreEqual(inserted.ActualStartDate, selectedAfterUpdate.ActualStartDate);
            Assert.AreEqual(inserted.ActualEndDate, selectedAfterUpdate.ActualEndDate);
            Assert.AreEqual(inserted.ActualResourceHrs, selectedAfterUpdate.ActualResourceHrs);
            Assert.AreEqual(inserted.PlannedCost, selectedAfterUpdate.PlannedCost);
            Assert.AreEqual(inserted.ActualCost, selectedAfterUpdate.ActualCost);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new WorkOrderRoutingModelPrimaryKey()
            {
                WorkOrderID       = inserted.WorkOrderID,
                ProductID         = inserted.ProductID,
                OperationSequence = inserted.OperationSequence,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #9
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            AddressModel inserted = new AddressModel();
            inserted.AddressLine1    = TestSession.Random.RandomString(60);
            inserted.AddressLine2    = TestSession.Random.RandomString(60);
            inserted.City            = TestSession.Random.RandomString(30);
            inserted.StateProvinceID = TestSession.Random.Next();
            inserted.PostalCode      = TestSession.Random.RandomString(15);
            inserted.SpatialLocation = TestSession.Random.RandomSqlGeography();
            inserted.rowguid         = Guid.NewGuid();
            inserted.ModifiedDate    = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new AddressModelPrimaryKey()
            {
                AddressID = inserted.AddressID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.AddressID, selectedAfterInsert.AddressID);
            Assert.AreEqual(inserted.AddressLine1, selectedAfterInsert.AddressLine1);
            Assert.AreEqual(inserted.AddressLine2, selectedAfterInsert.AddressLine2);
            Assert.AreEqual(inserted.City, selectedAfterInsert.City);
            Assert.AreEqual(inserted.StateProvinceID, selectedAfterInsert.StateProvinceID);
            Assert.AreEqual(inserted.PostalCode, selectedAfterInsert.PostalCode);
            Assert.AreEqual(inserted.SpatialLocation, selectedAfterInsert.SpatialLocation);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.AddressLine1    = TestSession.Random.RandomString(60);
            inserted.AddressLine2    = TestSession.Random.RandomString(60);
            inserted.City            = TestSession.Random.RandomString(30);
            inserted.StateProvinceID = TestSession.Random.Next();
            inserted.PostalCode      = TestSession.Random.RandomString(15);
            inserted.SpatialLocation = TestSession.Random.RandomSqlGeography();
            inserted.rowguid         = Guid.NewGuid();
            inserted.ModifiedDate    = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new AddressModelPrimaryKey()
            {
                AddressID = inserted.AddressID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.AddressID, selectedAfterUpdate.AddressID);
            Assert.AreEqual(inserted.AddressLine1, selectedAfterUpdate.AddressLine1);
            Assert.AreEqual(inserted.AddressLine2, selectedAfterUpdate.AddressLine2);
            Assert.AreEqual(inserted.City, selectedAfterUpdate.City);
            Assert.AreEqual(inserted.StateProvinceID, selectedAfterUpdate.StateProvinceID);
            Assert.AreEqual(inserted.PostalCode, selectedAfterUpdate.PostalCode);
            Assert.AreEqual(inserted.SpatialLocation, selectedAfterUpdate.SpatialLocation);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new AddressModelPrimaryKey()
            {
                AddressID = inserted.AddressID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            PurchaseOrderHeaderModel inserted = new PurchaseOrderHeaderModel();
            inserted.RevisionNumber = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.Status         = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.EmployeeID     = TestSession.Random.Next();
            inserted.VendorID       = TestSession.Random.Next();
            inserted.ShipMethodID   = TestSession.Random.Next();
            inserted.OrderDate      = TestSession.Random.RandomDateTime();
            inserted.ShipDate       = TestSession.Random.RandomDateTime();
            inserted.SubTotal       = TestSession.Random.RandomDecimal();
            inserted.TaxAmt         = TestSession.Random.RandomDecimal();
            inserted.Freight        = TestSession.Random.RandomDecimal();
            inserted.TotalDue       = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate   = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new PurchaseOrderHeaderModelPrimaryKey()
            {
                PurchaseOrderID = inserted.PurchaseOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.PurchaseOrderID, selectedAfterInsert.PurchaseOrderID);
            Assert.AreEqual(inserted.RevisionNumber, selectedAfterInsert.RevisionNumber);
            Assert.AreEqual(inserted.Status, selectedAfterInsert.Status);
            Assert.AreEqual(inserted.EmployeeID, selectedAfterInsert.EmployeeID);
            Assert.AreEqual(inserted.VendorID, selectedAfterInsert.VendorID);
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterInsert.ShipMethodID);
            Assert.AreEqual(inserted.OrderDate, selectedAfterInsert.OrderDate);
            Assert.AreEqual(inserted.ShipDate, selectedAfterInsert.ShipDate);
            Assert.AreEqual(inserted.SubTotal, selectedAfterInsert.SubTotal);
            Assert.AreEqual(inserted.TaxAmt, selectedAfterInsert.TaxAmt);
            Assert.AreEqual(inserted.Freight, selectedAfterInsert.Freight);
            Assert.AreEqual(inserted.TotalDue, selectedAfterInsert.TotalDue);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.RevisionNumber = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.Status         = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.EmployeeID     = TestSession.Random.Next();
            inserted.VendorID       = TestSession.Random.Next();
            inserted.ShipMethodID   = TestSession.Random.Next();
            inserted.OrderDate      = TestSession.Random.RandomDateTime();
            inserted.ShipDate       = TestSession.Random.RandomDateTime();
            inserted.SubTotal       = TestSession.Random.RandomDecimal();
            inserted.TaxAmt         = TestSession.Random.RandomDecimal();
            inserted.Freight        = TestSession.Random.RandomDecimal();
            inserted.TotalDue       = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate   = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new PurchaseOrderHeaderModelPrimaryKey()
            {
                PurchaseOrderID = inserted.PurchaseOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.PurchaseOrderID, selectedAfterUpdate.PurchaseOrderID);
            Assert.AreEqual(inserted.RevisionNumber, selectedAfterUpdate.RevisionNumber);
            Assert.AreEqual(inserted.Status, selectedAfterUpdate.Status);
            Assert.AreEqual(inserted.EmployeeID, selectedAfterUpdate.EmployeeID);
            Assert.AreEqual(inserted.VendorID, selectedAfterUpdate.VendorID);
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterUpdate.ShipMethodID);
            Assert.AreEqual(inserted.OrderDate, selectedAfterUpdate.OrderDate);
            Assert.AreEqual(inserted.ShipDate, selectedAfterUpdate.ShipDate);
            Assert.AreEqual(inserted.SubTotal, selectedAfterUpdate.SubTotal);
            Assert.AreEqual(inserted.TaxAmt, selectedAfterUpdate.TaxAmt);
            Assert.AreEqual(inserted.Freight, selectedAfterUpdate.Freight);
            Assert.AreEqual(inserted.TotalDue, selectedAfterUpdate.TotalDue);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new PurchaseOrderHeaderModelPrimaryKey()
            {
                PurchaseOrderID = inserted.PurchaseOrderID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            EmployeePayHistoryModel inserted = new EmployeePayHistoryModel();
            inserted.BusinessEntityID = TestSession.Random.Next();
            inserted.RateChangeDate   = TestSession.Random.RandomDateTime();
            inserted.Rate             = TestSession.Random.RandomDecimal(19, 4);
            inserted.PayFrequency     = Convert.ToByte(TestSession.Random.Next(255));
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new EmployeePayHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                RateChangeDate   = inserted.RateChangeDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.RateChangeDate, selectedAfterInsert.RateChangeDate);
            Assert.AreEqual(inserted.Rate, selectedAfterInsert.Rate);
            Assert.AreEqual(inserted.PayFrequency, selectedAfterInsert.PayFrequency);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.Rate         = TestSession.Random.RandomDecimal(19, 4);
            inserted.PayFrequency = Convert.ToByte(TestSession.Random.Next(255));
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new EmployeePayHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                RateChangeDate   = inserted.RateChangeDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.RateChangeDate, selectedAfterUpdate.RateChangeDate);
            Assert.AreEqual(inserted.Rate, selectedAfterUpdate.Rate);
            Assert.AreEqual(inserted.PayFrequency, selectedAfterUpdate.PayFrequency);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new EmployeePayHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                RateChangeDate   = inserted.RateChangeDate,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #12
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ProductReviewModel inserted = new ProductReviewModel();
            inserted.ProductID    = TestSession.Random.Next();
            inserted.ReviewerName = TestSession.Random.RandomString(50);
            inserted.ReviewDate   = TestSession.Random.RandomDateTime();
            inserted.EmailAddress = TestSession.Random.RandomString(50);
            inserted.Rating       = TestSession.Random.Next();
            inserted.Comments     = TestSession.Random.RandomString(3850);
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ProductReviewModelPrimaryKey()
            {
                ProductReviewID = inserted.ProductReviewID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ProductReviewID, selectedAfterInsert.ProductReviewID);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.ReviewerName, selectedAfterInsert.ReviewerName);
            Assert.AreEqual(inserted.ReviewDate, selectedAfterInsert.ReviewDate);
            Assert.AreEqual(inserted.EmailAddress, selectedAfterInsert.EmailAddress);
            Assert.AreEqual(inserted.Rating, selectedAfterInsert.Rating);
            Assert.AreEqual(inserted.Comments, selectedAfterInsert.Comments);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ProductID    = TestSession.Random.Next();
            inserted.ReviewerName = TestSession.Random.RandomString(50);
            inserted.ReviewDate   = TestSession.Random.RandomDateTime();
            inserted.EmailAddress = TestSession.Random.RandomString(50);
            inserted.Rating       = TestSession.Random.Next();
            inserted.Comments     = TestSession.Random.RandomString(3850);
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ProductReviewModelPrimaryKey()
            {
                ProductReviewID = inserted.ProductReviewID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ProductReviewID, selectedAfterUpdate.ProductReviewID);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.ReviewerName, selectedAfterUpdate.ReviewerName);
            Assert.AreEqual(inserted.ReviewDate, selectedAfterUpdate.ReviewDate);
            Assert.AreEqual(inserted.EmailAddress, selectedAfterUpdate.EmailAddress);
            Assert.AreEqual(inserted.Rating, selectedAfterUpdate.Rating);
            Assert.AreEqual(inserted.Comments, selectedAfterUpdate.Comments);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ProductReviewModelPrimaryKey()
            {
                ProductReviewID = inserted.ProductReviewID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #13
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            CreditCardModel inserted = new CreditCardModel();
            inserted.CardType     = TestSession.Random.RandomString(50);
            inserted.CardNumber   = TestSession.Random.RandomString(25);
            inserted.ExpMonth     = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.ExpYear      = TestSession.Random.RandomShort();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new CreditCardModelPrimaryKey()
            {
                CreditCardID = inserted.CreditCardID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.CreditCardID, selectedAfterInsert.CreditCardID);
            Assert.AreEqual(inserted.CardType, selectedAfterInsert.CardType);
            Assert.AreEqual(inserted.CardNumber, selectedAfterInsert.CardNumber);
            Assert.AreEqual(inserted.ExpMonth, selectedAfterInsert.ExpMonth);
            Assert.AreEqual(inserted.ExpYear, selectedAfterInsert.ExpYear);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.CardType     = TestSession.Random.RandomString(50);
            inserted.CardNumber   = TestSession.Random.RandomString(25);
            inserted.ExpMonth     = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.ExpYear      = TestSession.Random.RandomShort();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new CreditCardModelPrimaryKey()
            {
                CreditCardID = inserted.CreditCardID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.CreditCardID, selectedAfterUpdate.CreditCardID);
            Assert.AreEqual(inserted.CardType, selectedAfterUpdate.CardType);
            Assert.AreEqual(inserted.CardNumber, selectedAfterUpdate.CardNumber);
            Assert.AreEqual(inserted.ExpMonth, selectedAfterUpdate.ExpMonth);
            Assert.AreEqual(inserted.ExpYear, selectedAfterUpdate.ExpYear);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new CreditCardModelPrimaryKey()
            {
                CreditCardID = inserted.CreditCardID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            VendorModel inserted = new VendorModel();
            inserted.BusinessEntityID        = TestSession.Random.Next();
            inserted.AccountNumber           = TestSession.Random.RandomString(15);
            inserted.Name                    = TestSession.Random.RandomString(50);
            inserted.CreditRating            = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.PreferredVendorStatus   = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.ActiveFlag              = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.PurchasingWebServiceURL = TestSession.Random.RandomString(1024);
            inserted.ModifiedDate            = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new VendorModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.AccountNumber, selectedAfterInsert.AccountNumber);
            Assert.AreEqual(inserted.Name, selectedAfterInsert.Name);
            Assert.AreEqual(inserted.CreditRating, selectedAfterInsert.CreditRating);
            Assert.AreEqual(inserted.PreferredVendorStatus, selectedAfterInsert.PreferredVendorStatus);
            Assert.AreEqual(inserted.ActiveFlag, selectedAfterInsert.ActiveFlag);
            Assert.AreEqual(inserted.PurchasingWebServiceURL, selectedAfterInsert.PurchasingWebServiceURL);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.AccountNumber           = TestSession.Random.RandomString(15);
            inserted.Name                    = TestSession.Random.RandomString(50);
            inserted.CreditRating            = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.PreferredVendorStatus   = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.ActiveFlag              = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.PurchasingWebServiceURL = TestSession.Random.RandomString(1024);
            inserted.ModifiedDate            = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new VendorModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.AccountNumber, selectedAfterUpdate.AccountNumber);
            Assert.AreEqual(inserted.Name, selectedAfterUpdate.Name);
            Assert.AreEqual(inserted.CreditRating, selectedAfterUpdate.CreditRating);
            Assert.AreEqual(inserted.PreferredVendorStatus, selectedAfterUpdate.PreferredVendorStatus);
            Assert.AreEqual(inserted.ActiveFlag, selectedAfterUpdate.ActiveFlag);
            Assert.AreEqual(inserted.PurchasingWebServiceURL, selectedAfterUpdate.PurchasingWebServiceURL);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new VendorModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ShoppingCartItemModel inserted = new ShoppingCartItemModel();
            inserted.ShoppingCartID = TestSession.Random.RandomString(50);
            inserted.Quantity       = TestSession.Random.Next();
            inserted.ProductID      = TestSession.Random.Next();
            inserted.DateCreated    = TestSession.Random.RandomDateTime();
            inserted.ModifiedDate   = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ShoppingCartItemModelPrimaryKey()
            {
                ShoppingCartItemID = inserted.ShoppingCartItemID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ShoppingCartItemID, selectedAfterInsert.ShoppingCartItemID);
            Assert.AreEqual(inserted.ShoppingCartID, selectedAfterInsert.ShoppingCartID);
            Assert.AreEqual(inserted.Quantity, selectedAfterInsert.Quantity);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.DateCreated, selectedAfterInsert.DateCreated);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ShoppingCartID = TestSession.Random.RandomString(50);
            inserted.Quantity       = TestSession.Random.Next();
            inserted.ProductID      = TestSession.Random.Next();
            inserted.DateCreated    = TestSession.Random.RandomDateTime();
            inserted.ModifiedDate   = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ShoppingCartItemModelPrimaryKey()
            {
                ShoppingCartItemID = inserted.ShoppingCartItemID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ShoppingCartItemID, selectedAfterUpdate.ShoppingCartItemID);
            Assert.AreEqual(inserted.ShoppingCartID, selectedAfterUpdate.ShoppingCartID);
            Assert.AreEqual(inserted.Quantity, selectedAfterUpdate.Quantity);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.DateCreated, selectedAfterUpdate.DateCreated);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ShoppingCartItemModelPrimaryKey()
            {
                ShoppingCartItemID = inserted.ShoppingCartItemID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            StateProvinceModel inserted = new StateProvinceModel();
            inserted.StateProvinceCode       = TestSession.Random.RandomString(3);
            inserted.CountryRegionCode       = TestSession.Random.RandomString(3);
            inserted.IsOnlyStateProvinceFlag = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.TerritoryID  = TestSession.Random.Next();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new StateProvinceModelPrimaryKey()
            {
                StateProvinceID = inserted.StateProvinceID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.StateProvinceID, selectedAfterInsert.StateProvinceID);
            Assert.AreEqual(inserted.StateProvinceCode, selectedAfterInsert.StateProvinceCode);
            Assert.AreEqual(inserted.CountryRegionCode, selectedAfterInsert.CountryRegionCode);
            Assert.AreEqual(inserted.IsOnlyStateProvinceFlag, selectedAfterInsert.IsOnlyStateProvinceFlag);
            Assert.AreEqual(inserted.Name, selectedAfterInsert.Name);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterInsert.TerritoryID);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.StateProvinceCode       = TestSession.Random.RandomString(3);
            inserted.CountryRegionCode       = TestSession.Random.RandomString(3);
            inserted.IsOnlyStateProvinceFlag = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.TerritoryID  = TestSession.Random.Next();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new StateProvinceModelPrimaryKey()
            {
                StateProvinceID = inserted.StateProvinceID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.StateProvinceID, selectedAfterUpdate.StateProvinceID);
            Assert.AreEqual(inserted.StateProvinceCode, selectedAfterUpdate.StateProvinceCode);
            Assert.AreEqual(inserted.CountryRegionCode, selectedAfterUpdate.CountryRegionCode);
            Assert.AreEqual(inserted.IsOnlyStateProvinceFlag, selectedAfterUpdate.IsOnlyStateProvinceFlag);
            Assert.AreEqual(inserted.Name, selectedAfterUpdate.Name);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterUpdate.TerritoryID);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new StateProvinceModelPrimaryKey()
            {
                StateProvinceID = inserted.StateProvinceID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #17
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            PersonModel inserted = new PersonModel();
            inserted.BusinessEntityID      = TestSession.Random.Next();
            inserted.PersonType            = TestSession.Random.RandomString(2);
            inserted.NameStyle             = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Title                 = TestSession.Random.RandomString(8);
            inserted.FirstName             = TestSession.Random.RandomString(50);
            inserted.MiddleName            = TestSession.Random.RandomString(50);
            inserted.LastName              = TestSession.Random.RandomString(50);
            inserted.Suffix                = TestSession.Random.RandomString(10);
            inserted.EmailPromotion        = TestSession.Random.Next();
            inserted.AdditionalContactInfo = null; //TODO define how to generate random xml;
            inserted.Demographics          = null; //TODO define how to generate random xml;
            inserted.rowguid               = Guid.NewGuid();
            inserted.ModifiedDate          = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new PersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.PersonType, selectedAfterInsert.PersonType);
            Assert.AreEqual(inserted.NameStyle, selectedAfterInsert.NameStyle);
            Assert.AreEqual(inserted.Title, selectedAfterInsert.Title);
            Assert.AreEqual(inserted.FirstName, selectedAfterInsert.FirstName);
            Assert.AreEqual(inserted.MiddleName, selectedAfterInsert.MiddleName);
            Assert.AreEqual(inserted.LastName, selectedAfterInsert.LastName);
            Assert.AreEqual(inserted.Suffix, selectedAfterInsert.Suffix);
            Assert.AreEqual(inserted.EmailPromotion, selectedAfterInsert.EmailPromotion);
            Assert.AreEqual(inserted.AdditionalContactInfo, selectedAfterInsert.AdditionalContactInfo);
            Assert.AreEqual(inserted.Demographics, selectedAfterInsert.Demographics);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.PersonType            = TestSession.Random.RandomString(2);
            inserted.NameStyle             = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Title                 = TestSession.Random.RandomString(8);
            inserted.FirstName             = TestSession.Random.RandomString(50);
            inserted.MiddleName            = TestSession.Random.RandomString(50);
            inserted.LastName              = TestSession.Random.RandomString(50);
            inserted.Suffix                = TestSession.Random.RandomString(10);
            inserted.EmailPromotion        = TestSession.Random.Next();
            inserted.AdditionalContactInfo = null; //TODO define how to generate random xml;
            inserted.Demographics          = null; //TODO define how to generate random xml;
            inserted.rowguid               = Guid.NewGuid();
            inserted.ModifiedDate          = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new PersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.PersonType, selectedAfterUpdate.PersonType);
            Assert.AreEqual(inserted.NameStyle, selectedAfterUpdate.NameStyle);
            Assert.AreEqual(inserted.Title, selectedAfterUpdate.Title);
            Assert.AreEqual(inserted.FirstName, selectedAfterUpdate.FirstName);
            Assert.AreEqual(inserted.MiddleName, selectedAfterUpdate.MiddleName);
            Assert.AreEqual(inserted.LastName, selectedAfterUpdate.LastName);
            Assert.AreEqual(inserted.Suffix, selectedAfterUpdate.Suffix);
            Assert.AreEqual(inserted.EmailPromotion, selectedAfterUpdate.EmailPromotion);
            Assert.AreEqual(inserted.AdditionalContactInfo, selectedAfterUpdate.AdditionalContactInfo);
            Assert.AreEqual(inserted.Demographics, selectedAfterUpdate.Demographics);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new PersonModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            PasswordModel inserted = new PasswordModel();
            inserted.BusinessEntityID = TestSession.Random.Next();
            inserted.PasswordHash     = TestSession.Random.RandomString(128);
            inserted.PasswordSalt     = TestSession.Random.RandomString(10);
            inserted.rowguid          = Guid.NewGuid();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new PasswordModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.PasswordHash, selectedAfterInsert.PasswordHash);
            Assert.AreEqual(inserted.PasswordSalt, selectedAfterInsert.PasswordSalt);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.PasswordHash = TestSession.Random.RandomString(128);
            inserted.PasswordSalt = TestSession.Random.RandomString(10);
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new PasswordModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.PasswordHash, selectedAfterUpdate.PasswordHash);
            Assert.AreEqual(inserted.PasswordSalt, selectedAfterUpdate.PasswordSalt);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new PasswordModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #19
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            EmployeeDepartmentHistoryModel inserted = new EmployeeDepartmentHistoryModel();
            inserted.BusinessEntityID = TestSession.Random.Next();
            inserted.DepartmentID     = TestSession.Random.RandomShort();
            inserted.ShiftID          = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.StartDate        = TestSession.Random.RandomDateTime();
            inserted.EndDate          = TestSession.Random.RandomDateTime();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new EmployeeDepartmentHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                DepartmentID     = inserted.DepartmentID,
                ShiftID          = inserted.ShiftID,
                StartDate        = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterInsert.BusinessEntityID);
            Assert.AreEqual(inserted.DepartmentID, selectedAfterInsert.DepartmentID);
            Assert.AreEqual(inserted.ShiftID, selectedAfterInsert.ShiftID);
            Assert.AreEqual(inserted.StartDate, selectedAfterInsert.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterInsert.EndDate);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.EndDate      = TestSession.Random.RandomDateTime();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new EmployeeDepartmentHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                DepartmentID     = inserted.DepartmentID,
                ShiftID          = inserted.ShiftID,
                StartDate        = inserted.StartDate,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.BusinessEntityID, selectedAfterUpdate.BusinessEntityID);
            Assert.AreEqual(inserted.DepartmentID, selectedAfterUpdate.DepartmentID);
            Assert.AreEqual(inserted.ShiftID, selectedAfterUpdate.ShiftID);
            Assert.AreEqual(inserted.StartDate, selectedAfterUpdate.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterUpdate.EndDate);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new EmployeeDepartmentHistoryModelPrimaryKey()
            {
                BusinessEntityID = inserted.BusinessEntityID,
                DepartmentID     = inserted.DepartmentID,
                ShiftID          = inserted.ShiftID,
                StartDate        = inserted.StartDate,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #20
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();
        }
Example #21
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ShipMethodModel inserted = new ShipMethodModel();
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.ShipBase     = TestSession.Random.RandomDecimal();
            inserted.ShipRate     = TestSession.Random.RandomDecimal();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ShipMethodModelPrimaryKey()
            {
                ShipMethodID = inserted.ShipMethodID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterInsert.ShipMethodID);
            Assert.AreEqual(inserted.Name, selectedAfterInsert.Name);
            Assert.AreEqual(inserted.ShipBase, selectedAfterInsert.ShipBase);
            Assert.AreEqual(inserted.ShipRate, selectedAfterInsert.ShipRate);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.ShipBase     = TestSession.Random.RandomDecimal();
            inserted.ShipRate     = TestSession.Random.RandomDecimal();
            inserted.rowguid      = Guid.NewGuid();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ShipMethodModelPrimaryKey()
            {
                ShipMethodID = inserted.ShipMethodID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterUpdate.ShipMethodID);
            Assert.AreEqual(inserted.Name, selectedAfterUpdate.Name);
            Assert.AreEqual(inserted.ShipBase, selectedAfterUpdate.ShipBase);
            Assert.AreEqual(inserted.ShipRate, selectedAfterUpdate.ShipRate);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ShipMethodModelPrimaryKey()
            {
                ShipMethodID = inserted.ShipMethodID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #22
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            PurchaseOrderDetailModel inserted = new PurchaseOrderDetailModel();
            inserted.PurchaseOrderID = TestSession.Random.Next();
            inserted.DueDate         = TestSession.Random.RandomDateTime();
            inserted.OrderQty        = TestSession.Random.RandomShort();
            inserted.ProductID       = TestSession.Random.Next();
            inserted.UnitPrice       = TestSession.Random.RandomDecimal();
            inserted.LineTotal       = TestSession.Random.RandomDecimal();
            inserted.ReceivedQty     = TestSession.Random.RandomDecimal();
            inserted.RejectedQty     = TestSession.Random.RandomDecimal();
            inserted.StockedQty      = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate    = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new PurchaseOrderDetailModelPrimaryKey()
            {
                PurchaseOrderID       = inserted.PurchaseOrderID,
                PurchaseOrderDetailID = inserted.PurchaseOrderDetailID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.PurchaseOrderID, selectedAfterInsert.PurchaseOrderID);
            Assert.AreEqual(inserted.PurchaseOrderDetailID, selectedAfterInsert.PurchaseOrderDetailID);
            Assert.AreEqual(inserted.DueDate, selectedAfterInsert.DueDate);
            Assert.AreEqual(inserted.OrderQty, selectedAfterInsert.OrderQty);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.UnitPrice, selectedAfterInsert.UnitPrice);
            Assert.AreEqual(inserted.LineTotal, selectedAfterInsert.LineTotal);
            Assert.AreEqual(inserted.ReceivedQty, selectedAfterInsert.ReceivedQty);
            Assert.AreEqual(inserted.RejectedQty, selectedAfterInsert.RejectedQty);
            Assert.AreEqual(inserted.StockedQty, selectedAfterInsert.StockedQty);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.DueDate      = TestSession.Random.RandomDateTime();
            inserted.OrderQty     = TestSession.Random.RandomShort();
            inserted.ProductID    = TestSession.Random.Next();
            inserted.UnitPrice    = TestSession.Random.RandomDecimal();
            inserted.LineTotal    = TestSession.Random.RandomDecimal();
            inserted.ReceivedQty  = TestSession.Random.RandomDecimal();
            inserted.RejectedQty  = TestSession.Random.RandomDecimal();
            inserted.StockedQty   = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new PurchaseOrderDetailModelPrimaryKey()
            {
                PurchaseOrderID       = inserted.PurchaseOrderID,
                PurchaseOrderDetailID = inserted.PurchaseOrderDetailID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.PurchaseOrderID, selectedAfterUpdate.PurchaseOrderID);
            Assert.AreEqual(inserted.PurchaseOrderDetailID, selectedAfterUpdate.PurchaseOrderDetailID);
            Assert.AreEqual(inserted.DueDate, selectedAfterUpdate.DueDate);
            Assert.AreEqual(inserted.OrderQty, selectedAfterUpdate.OrderQty);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.UnitPrice, selectedAfterUpdate.UnitPrice);
            Assert.AreEqual(inserted.LineTotal, selectedAfterUpdate.LineTotal);
            Assert.AreEqual(inserted.ReceivedQty, selectedAfterUpdate.ReceivedQty);
            Assert.AreEqual(inserted.RejectedQty, selectedAfterUpdate.RejectedQty);
            Assert.AreEqual(inserted.StockedQty, selectedAfterUpdate.StockedQty);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new PurchaseOrderDetailModelPrimaryKey()
            {
                PurchaseOrderID       = inserted.PurchaseOrderID,
                PurchaseOrderDetailID = inserted.PurchaseOrderDetailID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #23
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            CurrencyRateModel inserted = new CurrencyRateModel();
            inserted.CurrencyRateDate = TestSession.Random.RandomDateTime();
            inserted.FromCurrencyCode = TestSession.Random.RandomString(3);
            inserted.ToCurrencyCode   = TestSession.Random.RandomString(3);
            inserted.AverageRate      = TestSession.Random.RandomDecimal();
            inserted.EndOfDayRate     = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new CurrencyRateModelPrimaryKey()
            {
                CurrencyRateID = inserted.CurrencyRateID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.CurrencyRateID, selectedAfterInsert.CurrencyRateID);
            Assert.AreEqual(inserted.CurrencyRateDate, selectedAfterInsert.CurrencyRateDate);
            Assert.AreEqual(inserted.FromCurrencyCode, selectedAfterInsert.FromCurrencyCode);
            Assert.AreEqual(inserted.ToCurrencyCode, selectedAfterInsert.ToCurrencyCode);
            Assert.AreEqual(inserted.AverageRate, selectedAfterInsert.AverageRate);
            Assert.AreEqual(inserted.EndOfDayRate, selectedAfterInsert.EndOfDayRate);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.CurrencyRateDate = TestSession.Random.RandomDateTime();
            inserted.FromCurrencyCode = TestSession.Random.RandomString(3);
            inserted.ToCurrencyCode   = TestSession.Random.RandomString(3);
            inserted.AverageRate      = TestSession.Random.RandomDecimal();
            inserted.EndOfDayRate     = TestSession.Random.RandomDecimal();
            inserted.ModifiedDate     = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new CurrencyRateModelPrimaryKey()
            {
                CurrencyRateID = inserted.CurrencyRateID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.CurrencyRateID, selectedAfterUpdate.CurrencyRateID);
            Assert.AreEqual(inserted.CurrencyRateDate, selectedAfterUpdate.CurrencyRateDate);
            Assert.AreEqual(inserted.FromCurrencyCode, selectedAfterUpdate.FromCurrencyCode);
            Assert.AreEqual(inserted.ToCurrencyCode, selectedAfterUpdate.ToCurrencyCode);
            Assert.AreEqual(inserted.AverageRate, selectedAfterUpdate.AverageRate);
            Assert.AreEqual(inserted.EndOfDayRate, selectedAfterUpdate.EndOfDayRate);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new CurrencyRateModelPrimaryKey()
            {
                CurrencyRateID = inserted.CurrencyRateID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            WorkOrderModel inserted = new WorkOrderModel();
            inserted.ProductID     = TestSession.Random.Next();
            inserted.OrderQty      = TestSession.Random.Next();
            inserted.StockedQty    = TestSession.Random.Next();
            inserted.ScrappedQty   = TestSession.Random.RandomShort();
            inserted.StartDate     = TestSession.Random.RandomDateTime();
            inserted.EndDate       = TestSession.Random.RandomDateTime();
            inserted.DueDate       = TestSession.Random.RandomDateTime();
            inserted.ScrapReasonID = TestSession.Random.RandomShort();
            inserted.ModifiedDate  = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new WorkOrderModelPrimaryKey()
            {
                WorkOrderID = inserted.WorkOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.WorkOrderID, selectedAfterInsert.WorkOrderID);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.OrderQty, selectedAfterInsert.OrderQty);
            Assert.AreEqual(inserted.StockedQty, selectedAfterInsert.StockedQty);
            Assert.AreEqual(inserted.ScrappedQty, selectedAfterInsert.ScrappedQty);
            Assert.AreEqual(inserted.StartDate, selectedAfterInsert.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterInsert.EndDate);
            Assert.AreEqual(inserted.DueDate, selectedAfterInsert.DueDate);
            Assert.AreEqual(inserted.ScrapReasonID, selectedAfterInsert.ScrapReasonID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.ProductID     = TestSession.Random.Next();
            inserted.OrderQty      = TestSession.Random.Next();
            inserted.StockedQty    = TestSession.Random.Next();
            inserted.ScrappedQty   = TestSession.Random.RandomShort();
            inserted.StartDate     = TestSession.Random.RandomDateTime();
            inserted.EndDate       = TestSession.Random.RandomDateTime();
            inserted.DueDate       = TestSession.Random.RandomDateTime();
            inserted.ScrapReasonID = TestSession.Random.RandomShort();
            inserted.ModifiedDate  = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new WorkOrderModelPrimaryKey()
            {
                WorkOrderID = inserted.WorkOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.WorkOrderID, selectedAfterUpdate.WorkOrderID);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.OrderQty, selectedAfterUpdate.OrderQty);
            Assert.AreEqual(inserted.StockedQty, selectedAfterUpdate.StockedQty);
            Assert.AreEqual(inserted.ScrappedQty, selectedAfterUpdate.ScrappedQty);
            Assert.AreEqual(inserted.StartDate, selectedAfterUpdate.StartDate);
            Assert.AreEqual(inserted.EndDate, selectedAfterUpdate.EndDate);
            Assert.AreEqual(inserted.DueDate, selectedAfterUpdate.DueDate);
            Assert.AreEqual(inserted.ScrapReasonID, selectedAfterUpdate.ScrapReasonID);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new WorkOrderModelPrimaryKey()
            {
                WorkOrderID = inserted.WorkOrderID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ErrorLogModel inserted = new ErrorLogModel();
            inserted.ErrorTime      = TestSession.Random.RandomDateTime();
            inserted.UserName       = TestSession.Random.RandomString(128);
            inserted.ErrorNumber    = TestSession.Random.Next();
            inserted.ErrorSeverity  = TestSession.Random.Next();
            inserted.ErrorState     = TestSession.Random.Next();
            inserted.ErrorProcedure = TestSession.Random.RandomString(126);
            inserted.ErrorLine      = TestSession.Random.Next();
            inserted.ErrorMessage   = TestSession.Random.RandomString(4000);

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ErrorLogModelPrimaryKey()
            {
                ErrorLogID = inserted.ErrorLogID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ErrorLogID, selectedAfterInsert.ErrorLogID);
            Assert.AreEqual(inserted.ErrorTime, selectedAfterInsert.ErrorTime);
            Assert.AreEqual(inserted.UserName, selectedAfterInsert.UserName);
            Assert.AreEqual(inserted.ErrorNumber, selectedAfterInsert.ErrorNumber);
            Assert.AreEqual(inserted.ErrorSeverity, selectedAfterInsert.ErrorSeverity);
            Assert.AreEqual(inserted.ErrorState, selectedAfterInsert.ErrorState);
            Assert.AreEqual(inserted.ErrorProcedure, selectedAfterInsert.ErrorProcedure);
            Assert.AreEqual(inserted.ErrorLine, selectedAfterInsert.ErrorLine);
            Assert.AreEqual(inserted.ErrorMessage, selectedAfterInsert.ErrorMessage);

            #endregion

            #region update and select by id test
            inserted.ErrorTime      = TestSession.Random.RandomDateTime();
            inserted.UserName       = TestSession.Random.RandomString(128);
            inserted.ErrorNumber    = TestSession.Random.Next();
            inserted.ErrorSeverity  = TestSession.Random.Next();
            inserted.ErrorState     = TestSession.Random.Next();
            inserted.ErrorProcedure = TestSession.Random.RandomString(126);
            inserted.ErrorLine      = TestSession.Random.Next();
            inserted.ErrorMessage   = TestSession.Random.RandomString(4000);

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ErrorLogModelPrimaryKey()
            {
                ErrorLogID = inserted.ErrorLogID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ErrorLogID, selectedAfterUpdate.ErrorLogID);
            Assert.AreEqual(inserted.ErrorTime, selectedAfterUpdate.ErrorTime);
            Assert.AreEqual(inserted.UserName, selectedAfterUpdate.UserName);
            Assert.AreEqual(inserted.ErrorNumber, selectedAfterUpdate.ErrorNumber);
            Assert.AreEqual(inserted.ErrorSeverity, selectedAfterUpdate.ErrorSeverity);
            Assert.AreEqual(inserted.ErrorState, selectedAfterUpdate.ErrorState);
            Assert.AreEqual(inserted.ErrorProcedure, selectedAfterUpdate.ErrorProcedure);
            Assert.AreEqual(inserted.ErrorLine, selectedAfterUpdate.ErrorLine);
            Assert.AreEqual(inserted.ErrorMessage, selectedAfterUpdate.ErrorMessage);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ErrorLogModelPrimaryKey()
            {
                ErrorLogID = inserted.ErrorLogID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            SalesOrderHeaderModel inserted = new SalesOrderHeaderModel();
            inserted.RevisionNumber         = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.OrderDate              = TestSession.Random.RandomDateTime();
            inserted.DueDate                = TestSession.Random.RandomDateTime();
            inserted.ShipDate               = TestSession.Random.RandomDateTime();
            inserted.Status                 = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.OnlineOrderFlag        = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.SalesOrderNumber       = TestSession.Random.RandomString(25);
            inserted.PurchaseOrderNumber    = TestSession.Random.RandomString(25);
            inserted.AccountNumber          = TestSession.Random.RandomString(15);
            inserted.CustomerID             = TestSession.Random.Next();
            inserted.SalesPersonID          = TestSession.Random.Next();
            inserted.TerritoryID            = TestSession.Random.Next();
            inserted.BillToAddressID        = TestSession.Random.Next();
            inserted.ShipToAddressID        = TestSession.Random.Next();
            inserted.ShipMethodID           = TestSession.Random.Next();
            inserted.CreditCardID           = TestSession.Random.Next();
            inserted.CreditCardApprovalCode = TestSession.Random.RandomString(15);
            inserted.CurrencyRateID         = TestSession.Random.Next();
            inserted.SubTotal               = TestSession.Random.RandomDecimal();
            inserted.TaxAmt                 = TestSession.Random.RandomDecimal();
            inserted.Freight                = TestSession.Random.RandomDecimal();
            inserted.TotalDue               = TestSession.Random.RandomDecimal();
            inserted.Comment                = TestSession.Random.RandomString(128);
            inserted.rowguid                = Guid.NewGuid();
            inserted.ModifiedDate           = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new SalesOrderHeaderModelPrimaryKey()
            {
                SalesOrderID = inserted.SalesOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.SalesOrderID, selectedAfterInsert.SalesOrderID);
            Assert.AreEqual(inserted.RevisionNumber, selectedAfterInsert.RevisionNumber);
            Assert.AreEqual(inserted.OrderDate, selectedAfterInsert.OrderDate);
            Assert.AreEqual(inserted.DueDate, selectedAfterInsert.DueDate);
            Assert.AreEqual(inserted.ShipDate, selectedAfterInsert.ShipDate);
            Assert.AreEqual(inserted.Status, selectedAfterInsert.Status);
            Assert.AreEqual(inserted.OnlineOrderFlag, selectedAfterInsert.OnlineOrderFlag);
            Assert.AreEqual(inserted.SalesOrderNumber, selectedAfterInsert.SalesOrderNumber);
            Assert.AreEqual(inserted.PurchaseOrderNumber, selectedAfterInsert.PurchaseOrderNumber);
            Assert.AreEqual(inserted.AccountNumber, selectedAfterInsert.AccountNumber);
            Assert.AreEqual(inserted.CustomerID, selectedAfterInsert.CustomerID);
            Assert.AreEqual(inserted.SalesPersonID, selectedAfterInsert.SalesPersonID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterInsert.TerritoryID);
            Assert.AreEqual(inserted.BillToAddressID, selectedAfterInsert.BillToAddressID);
            Assert.AreEqual(inserted.ShipToAddressID, selectedAfterInsert.ShipToAddressID);
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterInsert.ShipMethodID);
            Assert.AreEqual(inserted.CreditCardID, selectedAfterInsert.CreditCardID);
            Assert.AreEqual(inserted.CreditCardApprovalCode, selectedAfterInsert.CreditCardApprovalCode);
            Assert.AreEqual(inserted.CurrencyRateID, selectedAfterInsert.CurrencyRateID);
            Assert.AreEqual(inserted.SubTotal, selectedAfterInsert.SubTotal);
            Assert.AreEqual(inserted.TaxAmt, selectedAfterInsert.TaxAmt);
            Assert.AreEqual(inserted.Freight, selectedAfterInsert.Freight);
            Assert.AreEqual(inserted.TotalDue, selectedAfterInsert.TotalDue);
            Assert.AreEqual(inserted.Comment, selectedAfterInsert.Comment);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.RevisionNumber         = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.OrderDate              = TestSession.Random.RandomDateTime();
            inserted.DueDate                = TestSession.Random.RandomDateTime();
            inserted.ShipDate               = TestSession.Random.RandomDateTime();
            inserted.Status                 = Convert.ToByte(TestSession.Random.RandomString(3));
            inserted.OnlineOrderFlag        = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.SalesOrderNumber       = TestSession.Random.RandomString(25);
            inserted.PurchaseOrderNumber    = TestSession.Random.RandomString(25);
            inserted.AccountNumber          = TestSession.Random.RandomString(15);
            inserted.CustomerID             = TestSession.Random.Next();
            inserted.SalesPersonID          = TestSession.Random.Next();
            inserted.TerritoryID            = TestSession.Random.Next();
            inserted.BillToAddressID        = TestSession.Random.Next();
            inserted.ShipToAddressID        = TestSession.Random.Next();
            inserted.ShipMethodID           = TestSession.Random.Next();
            inserted.CreditCardID           = TestSession.Random.Next();
            inserted.CreditCardApprovalCode = TestSession.Random.RandomString(15);
            inserted.CurrencyRateID         = TestSession.Random.Next();
            inserted.SubTotal               = TestSession.Random.RandomDecimal();
            inserted.TaxAmt                 = TestSession.Random.RandomDecimal();
            inserted.Freight                = TestSession.Random.RandomDecimal();
            inserted.TotalDue               = TestSession.Random.RandomDecimal();
            inserted.Comment                = TestSession.Random.RandomString(128);
            inserted.rowguid                = Guid.NewGuid();
            inserted.ModifiedDate           = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new SalesOrderHeaderModelPrimaryKey()
            {
                SalesOrderID = inserted.SalesOrderID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.SalesOrderID, selectedAfterUpdate.SalesOrderID);
            Assert.AreEqual(inserted.RevisionNumber, selectedAfterUpdate.RevisionNumber);
            Assert.AreEqual(inserted.OrderDate, selectedAfterUpdate.OrderDate);
            Assert.AreEqual(inserted.DueDate, selectedAfterUpdate.DueDate);
            Assert.AreEqual(inserted.ShipDate, selectedAfterUpdate.ShipDate);
            Assert.AreEqual(inserted.Status, selectedAfterUpdate.Status);
            Assert.AreEqual(inserted.OnlineOrderFlag, selectedAfterUpdate.OnlineOrderFlag);
            Assert.AreEqual(inserted.SalesOrderNumber, selectedAfterUpdate.SalesOrderNumber);
            Assert.AreEqual(inserted.PurchaseOrderNumber, selectedAfterUpdate.PurchaseOrderNumber);
            Assert.AreEqual(inserted.AccountNumber, selectedAfterUpdate.AccountNumber);
            Assert.AreEqual(inserted.CustomerID, selectedAfterUpdate.CustomerID);
            Assert.AreEqual(inserted.SalesPersonID, selectedAfterUpdate.SalesPersonID);
            Assert.AreEqual(inserted.TerritoryID, selectedAfterUpdate.TerritoryID);
            Assert.AreEqual(inserted.BillToAddressID, selectedAfterUpdate.BillToAddressID);
            Assert.AreEqual(inserted.ShipToAddressID, selectedAfterUpdate.ShipToAddressID);
            Assert.AreEqual(inserted.ShipMethodID, selectedAfterUpdate.ShipMethodID);
            Assert.AreEqual(inserted.CreditCardID, selectedAfterUpdate.CreditCardID);
            Assert.AreEqual(inserted.CreditCardApprovalCode, selectedAfterUpdate.CreditCardApprovalCode);
            Assert.AreEqual(inserted.CurrencyRateID, selectedAfterUpdate.CurrencyRateID);
            Assert.AreEqual(inserted.SubTotal, selectedAfterUpdate.SubTotal);
            Assert.AreEqual(inserted.TaxAmt, selectedAfterUpdate.TaxAmt);
            Assert.AreEqual(inserted.Freight, selectedAfterUpdate.Freight);
            Assert.AreEqual(inserted.TotalDue, selectedAfterUpdate.TotalDue);
            Assert.AreEqual(inserted.Comment, selectedAfterUpdate.Comment);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new SalesOrderHeaderModelPrimaryKey()
            {
                SalesOrderID = inserted.SalesOrderID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #27
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ShiftModel inserted = new ShiftModel();
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.StartTime    = new TimeSpan(0, 0, 0, TestSession.Random.Next(86400));
            inserted.EndTime      = new TimeSpan(0, 0, 0, TestSession.Random.Next(86400));
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ShiftModelPrimaryKey()
            {
                ShiftID = inserted.ShiftID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ShiftID, selectedAfterInsert.ShiftID);
            Assert.AreEqual(inserted.Name, selectedAfterInsert.Name);
            Assert.AreEqual(inserted.StartTime, selectedAfterInsert.StartTime);
            Assert.AreEqual(inserted.EndTime, selectedAfterInsert.EndTime);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.Name         = TestSession.Random.RandomString(50);
            inserted.StartTime    = new TimeSpan(0, 0, 0, TestSession.Random.Next(86400));
            inserted.EndTime      = new TimeSpan(0, 0, 0, TestSession.Random.Next(86400));
            inserted.ModifiedDate = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ShiftModelPrimaryKey()
            {
                ShiftID = inserted.ShiftID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ShiftID, selectedAfterUpdate.ShiftID);
            Assert.AreEqual(inserted.Name, selectedAfterUpdate.Name);
            Assert.AreEqual(inserted.StartTime, selectedAfterUpdate.StartTime);
            Assert.AreEqual(inserted.EndTime, selectedAfterUpdate.EndTime);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ShiftModelPrimaryKey()
            {
                ShiftID = inserted.ShiftID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #28
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            SalesOrderDetailModel inserted = new SalesOrderDetailModel();
            inserted.SalesOrderID          = TestSession.Random.Next();
            inserted.CarrierTrackingNumber = TestSession.Random.RandomString(25);
            inserted.OrderQty          = TestSession.Random.RandomShort();
            inserted.ProductID         = TestSession.Random.Next();
            inserted.SpecialOfferID    = TestSession.Random.Next();
            inserted.UnitPrice         = TestSession.Random.RandomDecimal();
            inserted.UnitPriceDiscount = TestSession.Random.RandomDecimal();
            inserted.LineTotal         = TestSession.Random.RandomDecimal();
            inserted.rowguid           = Guid.NewGuid();
            inserted.ModifiedDate      = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new SalesOrderDetailModelPrimaryKey()
            {
                SalesOrderID       = inserted.SalesOrderID,
                SalesOrderDetailID = inserted.SalesOrderDetailID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.SalesOrderID, selectedAfterInsert.SalesOrderID);
            Assert.AreEqual(inserted.SalesOrderDetailID, selectedAfterInsert.SalesOrderDetailID);
            Assert.AreEqual(inserted.CarrierTrackingNumber, selectedAfterInsert.CarrierTrackingNumber);
            Assert.AreEqual(inserted.OrderQty, selectedAfterInsert.OrderQty);
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.SpecialOfferID, selectedAfterInsert.SpecialOfferID);
            Assert.AreEqual(inserted.UnitPrice, selectedAfterInsert.UnitPrice);
            Assert.AreEqual(inserted.UnitPriceDiscount, selectedAfterInsert.UnitPriceDiscount);
            Assert.AreEqual(inserted.LineTotal, selectedAfterInsert.LineTotal);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.CarrierTrackingNumber = TestSession.Random.RandomString(25);
            inserted.OrderQty          = TestSession.Random.RandomShort();
            inserted.ProductID         = TestSession.Random.Next();
            inserted.SpecialOfferID    = TestSession.Random.Next();
            inserted.UnitPrice         = TestSession.Random.RandomDecimal();
            inserted.UnitPriceDiscount = TestSession.Random.RandomDecimal();
            inserted.LineTotal         = TestSession.Random.RandomDecimal();
            inserted.rowguid           = Guid.NewGuid();
            inserted.ModifiedDate      = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new SalesOrderDetailModelPrimaryKey()
            {
                SalesOrderID       = inserted.SalesOrderID,
                SalesOrderDetailID = inserted.SalesOrderDetailID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.SalesOrderID, selectedAfterUpdate.SalesOrderID);
            Assert.AreEqual(inserted.SalesOrderDetailID, selectedAfterUpdate.SalesOrderDetailID);
            Assert.AreEqual(inserted.CarrierTrackingNumber, selectedAfterUpdate.CarrierTrackingNumber);
            Assert.AreEqual(inserted.OrderQty, selectedAfterUpdate.OrderQty);
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.SpecialOfferID, selectedAfterUpdate.SpecialOfferID);
            Assert.AreEqual(inserted.UnitPrice, selectedAfterUpdate.UnitPrice);
            Assert.AreEqual(inserted.UnitPriceDiscount, selectedAfterUpdate.UnitPriceDiscount);
            Assert.AreEqual(inserted.LineTotal, selectedAfterUpdate.LineTotal);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new SalesOrderDetailModelPrimaryKey()
            {
                SalesOrderID       = inserted.SalesOrderID,
                SalesOrderDetailID = inserted.SalesOrderDetailID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
Example #29
0
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            DatabaseLogModel inserted = new DatabaseLogModel();
            inserted.PostTime     = TestSession.Random.RandomDateTime();
            inserted.DatabaseUser = TestSession.Random.RandomString(128);
            inserted.Event        = TestSession.Random.RandomString(128);
            inserted.Schema       = TestSession.Random.RandomString(128);
            inserted.Object       = TestSession.Random.RandomString(128);
            inserted.TSQL         = TestSession.Random.RandomString(-1);
            var xml = new XmlDocument();
            xml.LoadXml(@"<EVENT_INSTANCE><EventType>CREATE_TABLE</EventType><PostTime>2017-10-27T14:33:01.373</PostTime><SPID>56</SPID><ServerName>BARBKESS24\MSSQL2017RTM</ServerName><LoginName>REDMOND\barbkess</LoginName><UserName>dbo</UserName><DatabaseName>AdventureWorks2017</DatabaseName><SchemaName>dbo</SchemaName><ObjectName>ErrorLog</ObjectName><ObjectType>TABLE</ObjectType><TSQLCommand><SetOptions ANSI_NULLS=""ON"" ANSI_NULL_DEFAULT=""ON"" ANSI_PADDING=""ON"" QUOTED_IDENTIFIER=""ON"" ENCRYPTED=""FALSE"" /><CommandText>CREATE TABLE [dbo].[ErrorLog](
    [ErrorLogID][int] IDENTITY(1, 1) NOT NULL,
    [ErrorTime][datetime] NOT NULL CONSTRAINT[DF_ErrorLog_ErrorTime] DEFAULT(GETDATE()),
    [UserName][sysname] NOT NULL,
    [ErrorNumber][int] NOT NULL,
    [ErrorSeverity][int] NULL,
    [ErrorState][int] NULL,
    [ErrorProcedure][nvarchar](126) NULL,
    [ErrorLine][int] NULL,
    [ErrorMessage][nvarchar](4000) NOT NULL
) ON[PRIMARY] </CommandText></TSQLCommand></EVENT_INSTANCE>");
            inserted.XmlEvent = xml;

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new DatabaseLogModelPrimaryKey()
            {
                DatabaseLogID = inserted.DatabaseLogID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.DatabaseLogID, selectedAfterInsert.DatabaseLogID);
            Assert.AreEqual(inserted.PostTime, selectedAfterInsert.PostTime);
            Assert.AreEqual(inserted.DatabaseUser, selectedAfterInsert.DatabaseUser);
            Assert.AreEqual(inserted.Event, selectedAfterInsert.Event);
            Assert.AreEqual(inserted.Schema, selectedAfterInsert.Schema);
            Assert.AreEqual(inserted.Object, selectedAfterInsert.Object);
            Assert.AreEqual(inserted.TSQL, selectedAfterInsert.TSQL);
            Assert.AreEqual(inserted.XmlEvent.ToString(), selectedAfterInsert.XmlEvent.ToString());

            #endregion

            #region update and select by id test
            inserted.PostTime     = TestSession.Random.RandomDateTime();
            inserted.DatabaseUser = TestSession.Random.RandomString(128);
            inserted.Event        = TestSession.Random.RandomString(128);
            inserted.Schema       = TestSession.Random.RandomString(128);
            inserted.Object       = TestSession.Random.RandomString(128);
            inserted.TSQL         = TestSession.Random.RandomString(-1);
            var updatedXml = new XmlDocument();
            updatedXml.LoadXml(@"<EVENT_INSTANCE><EventType>DROP_TABLE</EventType><PostTime>2017-10-27T14:33:01.373</PostTime><SPID>56</SPID><ServerName>BARBKESS24\MSSQL2017RTM</ServerName><LoginName>REDMOND\barbkess</LoginName><UserName>dbo</UserName><DatabaseName>AdventureWorks2017</DatabaseName><SchemaName>dbo</SchemaName><ObjectName>ErrorLog</ObjectName><ObjectType>TABLE</ObjectType><TSQLCommand><SetOptions ANSI_NULLS=""ON"" ANSI_NULL_DEFAULT=""ON"" ANSI_PADDING=""ON"" QUOTED_IDENTIFIER=""ON"" ENCRYPTED=""FALSE"" /><CommandText>CREATE TABLE [dbo].[ErrorLog](
    [ErrorLogID][int] IDENTITY(1, 1) NOT NULL,
    [ErrorTime][datetime] NOT NULL CONSTRAINT[DF_ErrorLog_ErrorTime] DEFAULT(GETDATE()),
    [UserName][sysname] NOT NULL,
    [ErrorNumber][int] NOT NULL,
    [ErrorSeverity][int] NULL,
    [ErrorState][int] NULL,
    [ErrorProcedure][nvarchar](126) NULL,
    [ErrorLine][int] NULL,
    [ErrorMessage][nvarchar](4000) NOT NULL
) ON[PRIMARY] </CommandText></TSQLCommand></EVENT_INSTANCE>");
            inserted.XmlEvent = updatedXml;

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new DatabaseLogModelPrimaryKey()
            {
                DatabaseLogID = inserted.DatabaseLogID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.DatabaseLogID, selectedAfterUpdate.DatabaseLogID);
            Assert.AreEqual(inserted.PostTime, selectedAfterUpdate.PostTime);
            Assert.AreEqual(inserted.DatabaseUser, selectedAfterUpdate.DatabaseUser);
            Assert.AreEqual(inserted.Event, selectedAfterUpdate.Event);
            Assert.AreEqual(inserted.Schema, selectedAfterUpdate.Schema);
            Assert.AreEqual(inserted.Object, selectedAfterUpdate.Object);
            Assert.AreEqual(inserted.TSQL, selectedAfterUpdate.TSQL);
            Assert.AreEqual(inserted.XmlEvent.ToString(), selectedAfterUpdate.XmlEvent.ToString());

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new DatabaseLogModelPrimaryKey()
            {
                DatabaseLogID = inserted.DatabaseLogID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }
        public void IntegrationTest()
        {
            var connection = TestSession.GetConnection();

            connection.Open();
            #region good insertion and select by id test
            ProductModel inserted = new ProductModel();
            inserted.Name                  = TestSession.Random.RandomString(50);
            inserted.ProductNumber         = TestSession.Random.RandomString(25);
            inserted.MakeFlag              = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.FinishedGoodsFlag     = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Color                 = TestSession.Random.RandomString(15);
            inserted.SafetyStockLevel      = TestSession.Random.RandomShort();
            inserted.ReorderPoint          = TestSession.Random.RandomShort();
            inserted.StandardCost          = TestSession.Random.RandomDecimal();
            inserted.ListPrice             = TestSession.Random.RandomDecimal();
            inserted.Size                  = TestSession.Random.RandomString(5);
            inserted.SizeUnitMeasureCode   = TestSession.Random.RandomString(3);
            inserted.WeightUnitMeasureCode = TestSession.Random.RandomString(3);
            inserted.Weight                = TestSession.Random.RandomDecimal();
            inserted.DaysToManufacture     = TestSession.Random.Next();
            inserted.ProductLine           = TestSession.Random.RandomString(2);
            inserted.Class                 = TestSession.Random.RandomString(2);
            inserted.Style                 = TestSession.Random.RandomString(2);
            inserted.ProductSubcategoryID  = TestSession.Random.Next();
            inserted.ProductModelID        = TestSession.Random.Next();
            inserted.SellStartDate         = TestSession.Random.RandomDateTime();
            inserted.SellEndDate           = TestSession.Random.RandomDateTime();
            inserted.DiscontinuedDate      = TestSession.Random.RandomDateTime();
            inserted.rowguid               = Guid.NewGuid();
            inserted.ModifiedDate          = TestSession.Random.RandomDateTime();

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

            var selectedAfterInsertion = _tested.GetByPrimaryKey(connection, new ProductModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterInsertion);
            var selectedAfterInsert = selectedAfterInsertion.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterInsert.ProductID);
            Assert.AreEqual(inserted.Name, selectedAfterInsert.Name);
            Assert.AreEqual(inserted.ProductNumber, selectedAfterInsert.ProductNumber);
            Assert.AreEqual(inserted.MakeFlag, selectedAfterInsert.MakeFlag);
            Assert.AreEqual(inserted.FinishedGoodsFlag, selectedAfterInsert.FinishedGoodsFlag);
            Assert.AreEqual(inserted.Color, selectedAfterInsert.Color);
            Assert.AreEqual(inserted.SafetyStockLevel, selectedAfterInsert.SafetyStockLevel);
            Assert.AreEqual(inserted.ReorderPoint, selectedAfterInsert.ReorderPoint);
            Assert.AreEqual(inserted.StandardCost, selectedAfterInsert.StandardCost);
            Assert.AreEqual(inserted.ListPrice, selectedAfterInsert.ListPrice);
            Assert.AreEqual(inserted.Size, selectedAfterInsert.Size);
            Assert.AreEqual(inserted.SizeUnitMeasureCode, selectedAfterInsert.SizeUnitMeasureCode);
            Assert.AreEqual(inserted.WeightUnitMeasureCode, selectedAfterInsert.WeightUnitMeasureCode);
            Assert.AreEqual(inserted.Weight, selectedAfterInsert.Weight);
            Assert.AreEqual(inserted.DaysToManufacture, selectedAfterInsert.DaysToManufacture);
            Assert.AreEqual(inserted.ProductLine, selectedAfterInsert.ProductLine);
            Assert.AreEqual(inserted.Class, selectedAfterInsert.Class);
            Assert.AreEqual(inserted.Style, selectedAfterInsert.Style);
            Assert.AreEqual(inserted.ProductSubcategoryID, selectedAfterInsert.ProductSubcategoryID);
            Assert.AreEqual(inserted.ProductModelID, selectedAfterInsert.ProductModelID);
            Assert.AreEqual(inserted.SellStartDate, selectedAfterInsert.SellStartDate);
            Assert.AreEqual(inserted.SellEndDate, selectedAfterInsert.SellEndDate);
            Assert.AreEqual(inserted.DiscontinuedDate, selectedAfterInsert.DiscontinuedDate);
            Assert.AreEqual(inserted.rowguid, selectedAfterInsert.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterInsert.ModifiedDate);

            #endregion

            #region update and select by id test
            inserted.Name                  = TestSession.Random.RandomString(50);
            inserted.ProductNumber         = TestSession.Random.RandomString(25);
            inserted.MakeFlag              = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.FinishedGoodsFlag     = Convert.ToBoolean(TestSession.Random.Next(1));
            inserted.Color                 = TestSession.Random.RandomString(15);
            inserted.SafetyStockLevel      = TestSession.Random.RandomShort();
            inserted.ReorderPoint          = TestSession.Random.RandomShort();
            inserted.StandardCost          = TestSession.Random.RandomDecimal();
            inserted.ListPrice             = TestSession.Random.RandomDecimal();
            inserted.Size                  = TestSession.Random.RandomString(5);
            inserted.SizeUnitMeasureCode   = TestSession.Random.RandomString(3);
            inserted.WeightUnitMeasureCode = TestSession.Random.RandomString(3);
            inserted.Weight                = TestSession.Random.RandomDecimal();
            inserted.DaysToManufacture     = TestSession.Random.Next();
            inserted.ProductLine           = TestSession.Random.RandomString(2);
            inserted.Class                 = TestSession.Random.RandomString(2);
            inserted.Style                 = TestSession.Random.RandomString(2);
            inserted.ProductSubcategoryID  = TestSession.Random.Next();
            inserted.ProductModelID        = TestSession.Random.Next();
            inserted.SellStartDate         = TestSession.Random.RandomDateTime();
            inserted.SellEndDate           = TestSession.Random.RandomDateTime();
            inserted.DiscontinuedDate      = TestSession.Random.RandomDateTime();
            inserted.rowguid               = Guid.NewGuid();
            inserted.ModifiedDate          = TestSession.Random.RandomDateTime();

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

            var selectedAfterUpdateAddresss = _tested.GetByPrimaryKey(connection, new ProductModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
            });

            CollectionAssert.IsNotEmpty(selectedAfterUpdateAddresss);
            var selectedAfterUpdate = selectedAfterUpdateAddresss.Single();
            Assert.AreEqual(inserted.ProductID, selectedAfterUpdate.ProductID);
            Assert.AreEqual(inserted.Name, selectedAfterUpdate.Name);
            Assert.AreEqual(inserted.ProductNumber, selectedAfterUpdate.ProductNumber);
            Assert.AreEqual(inserted.MakeFlag, selectedAfterUpdate.MakeFlag);
            Assert.AreEqual(inserted.FinishedGoodsFlag, selectedAfterUpdate.FinishedGoodsFlag);
            Assert.AreEqual(inserted.Color, selectedAfterUpdate.Color);
            Assert.AreEqual(inserted.SafetyStockLevel, selectedAfterUpdate.SafetyStockLevel);
            Assert.AreEqual(inserted.ReorderPoint, selectedAfterUpdate.ReorderPoint);
            Assert.AreEqual(inserted.StandardCost, selectedAfterUpdate.StandardCost);
            Assert.AreEqual(inserted.ListPrice, selectedAfterUpdate.ListPrice);
            Assert.AreEqual(inserted.Size, selectedAfterUpdate.Size);
            Assert.AreEqual(inserted.SizeUnitMeasureCode, selectedAfterUpdate.SizeUnitMeasureCode);
            Assert.AreEqual(inserted.WeightUnitMeasureCode, selectedAfterUpdate.WeightUnitMeasureCode);
            Assert.AreEqual(inserted.Weight, selectedAfterUpdate.Weight);
            Assert.AreEqual(inserted.DaysToManufacture, selectedAfterUpdate.DaysToManufacture);
            Assert.AreEqual(inserted.ProductLine, selectedAfterUpdate.ProductLine);
            Assert.AreEqual(inserted.Class, selectedAfterUpdate.Class);
            Assert.AreEqual(inserted.Style, selectedAfterUpdate.Style);
            Assert.AreEqual(inserted.ProductSubcategoryID, selectedAfterUpdate.ProductSubcategoryID);
            Assert.AreEqual(inserted.ProductModelID, selectedAfterUpdate.ProductModelID);
            Assert.AreEqual(inserted.SellStartDate, selectedAfterUpdate.SellStartDate);
            Assert.AreEqual(inserted.SellEndDate, selectedAfterUpdate.SellEndDate);
            Assert.AreEqual(inserted.DiscontinuedDate, selectedAfterUpdate.DiscontinuedDate);
            Assert.AreEqual(inserted.rowguid, selectedAfterUpdate.rowguid);
            Assert.AreEqual(inserted.ModifiedDate, selectedAfterUpdate.ModifiedDate);

            #endregion

            #region delete test
            _tested.Delete(connection, new[] { inserted });
            var selectedAfterDeleteAddresss = _tested.GetByPrimaryKey(connection, new ProductModelPrimaryKey()
            {
                ProductID = inserted.ProductID,
            });
            CollectionAssert.IsEmpty(selectedAfterDeleteAddresss);
            #endregion
            connection.Close();
        }