static void Main(string[] args) { //Arrange: Create an empty repository BusinessRepository<MockBusinessUnit> collection = new MockBusinessRepository(); //Act: an entry is added collection.Create(new MockBusinessUnit()); /* Repository.Configuration.connString = "Server=localhost;Database=ApplicationData;Trusted_Connection=True;"; string connString = Repository.Configuration.connString; int result; * / /*Disposable items required to create the transaction are declared.*/ /* using (SqlConnection conn = new SqlConnection(connString)) using (SqlCommand cmd = new SqlCommand("TESTING_PROCEDURES", conn)) { cmd.CommandType = CommandType.StoredProcedure; SqlParameter returnValue = new SqlParameter(); returnValue.Direction = ParameterDirection.ReturnValue; cmd.Parameters.Add("@i", SqlDbType.Int).Value = 1; cmd.Parameters.Add(returnValue); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); result = (int)returnValue.Value; } Console.WriteLine(result); */ }
public void BusinessRepository_AddingUniqueEntry_IncreasesSizeByOne() { //Arrange: Create an empty repository BusinessRepository<MockBusinessUnit> collection = new MockBusinessRepository(); //Act: an entry is added collection.Create(new MockBusinessUnit()); //Assert: The size is now one Assert.AreEqual(collection.Count, 1); }
public void BusinessRepository_MultipleNullStrings_FormatMakesAllEmpty() { //Arrange: a presentation repository with multiple units of unformatted strings BusinessRepository<MockBusinessUnit> collection = new MockBusinessRepository(); collection.Create(new MockBusinessUnit { attrTwo = null }); collection.Create(new MockBusinessUnit { attrTwo = null}); //Act: The presentation repositorie's format function is called collection.Format(); collection.ForEach(x => Assert.AreEqual(x.attrTwo, string.Empty)); }