/ Published in: C#

using (var scope = new TransactionScope()) makes sure that any changes to the database are temporary and only last as long as the test is running.
The ExecuteScalar is used to get a value from the table.
The ExecuteNonQuery is used to insert a record that the test will use.
_target is the class that is accessing the database.
The ExecuteScalar is used to get a value from the table.
The ExecuteNonQuery is used to insert a record that the test will use.
_target is the class that is accessing the database.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
[TestMethod] public void GetBiAutoProcessConfigByKeys_Test() { { // Setup var topMx = (int)ExecuteScalar(string.Format("SELECT TOP 1 [mx_company_id] FROM [dbo].[bi_broker_invoice_number]")); ExecuteNonQuery(string.Format("INSERT INTO [dbo].[bi_auto_process_config] VALUES(39, 15, 1, 0, 1)")); // Action var result = _target.GetProcessConfigByKeys(15, 39, null); // Assert Assert.IsNotNull(result); Assert.IsTrue(result.BusinessUnitId==39); Assert.IsTrue(result.TransactionTypeId==15); } }
Comments
