示例#1
0
        internal static void Delete(IDataStore dataStore, ArticleGroup articleGroup)
        {
            ArticleGroupManager manager = new ArticleGroupManager(dataStore);

            BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Delete(articleGroup);

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.IsNull(manager.GetArticleGroup(articleGroup.ArticleGroupId));

            Trace.WriteLine("Successfully deleted articleGroup " + articleGroup.Name);
        }
示例#2
0
        internal static ArticleGroup Create(IDataStore dataStore, IApplicationSettings applicationSettings, IApplication application, Random random)
        {
            ArticleGroupManager manager = new ArticleGroupManager(dataStore);

            ArticleGroup articleGroup = new ArticleGroup(
                application.ApplicationId
                , "TestArticleGroup " + random.Next(1000000, 10000000)
                , true);

            BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Create(articleGroup);

            Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status);
            Assert.Greater(articleGroup.ArticleGroupId, 0);

            ArticleGroup dsArticleGroup = manager.GetArticleGroup(articleGroup.ArticleGroupId);

            Assert.IsNotNull(dsArticleGroup);

            return(dsArticleGroup);
        }
示例#3
0
        public void Test_CreateUpdateDeleteArticleGroup()
        {
            ArticleGroupManager manager = new ArticleGroupManager(this.DataStore);
            ArticleGroup        record  = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random);

            ArticleGroup recordToCompare;

            for (int i = 0; i < this.DefaultUpdateTestIterations; i++)
            {
                PopulateWithRandomValues(record, this.DummyDataManager, this.Random);
                recordToCompare = record;

                manager.Update(record);
                record = manager.GetArticleGroup(record.ArticleGroupId);

                string errors = string.Empty;

                // TODO (Roman): relax datetime comparisons
                Assert.IsTrue(DebugUtility.ArePropertyValuesEqual(record, recordToCompare, out errors), errors);
                Trace.WriteLine("Update test successfull.");
            }

            Delete(this.DataStore, record);
        }