public void SearchMessageInDatabase() { #region Test Setup List<MessagePing> testSubjects; string source = "+919840200524"; #endregion #region Test using (var context = new MessagingContext(connectionStringName)) { var checkRecordExistence = AssertRecordExistence(recordId, context); testSubjects = context.Where(d => d.Source == source).ToList<MessagePing>(); Assert.IsNotNull(testSubjects, "Record not found in database"); CollectionAssert.Contains(testSubjects, checkRecordExistence, "Record found in the database did not match record id"); } #endregion }