コード例 #1
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                Document mock   = CreateMockInstance(tm);
                bool     result = DataRepository.DocumentProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                DocumentQuery query = new DocumentQuery();

                query.AppendEquals(DocumentColumn.DocumentId, mock.DocumentId.ToString());
                query.AppendEquals(DocumentColumn.Title, mock.Title.ToString());
                query.AppendEquals(DocumentColumn.FileName, mock.FileName.ToString());
                query.AppendEquals(DocumentColumn.FileExtension, mock.FileExtension.ToString());
                query.AppendEquals(DocumentColumn.Revision, mock.Revision.ToString());
                query.AppendEquals(DocumentColumn.ChangeNumber, mock.ChangeNumber.ToString());
                query.AppendEquals(DocumentColumn.Status, mock.Status.ToString());
                if (mock.DocumentSummary != null)
                {
                    query.AppendEquals(DocumentColumn.DocumentSummary, mock.DocumentSummary.ToString());
                }
                query.AppendEquals(DocumentColumn.ModifiedDate, mock.ModifiedDate.ToString());

                TList <Document> results = DataRepository.DocumentProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }