Beispiel #1
0
        public void Test_Gets()
        {
            List <CMSSection> records = new List <CMSSection>();
            CMSSectionManager manager = new CMSSectionManager(this.DataStore);

            CMSSectionType sectionType = DebugUtility.GetRandomEnum <CMSSectionType>(this.Random);

            for (int i = 0; i < 10; i++)
            {
                records.Add(Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, null, this.Random));
            }
            foreach (CMSSection record in records)
            {
                record.CMSSectionType = sectionType;
                manager.Update(record);
            }

            List <CMSSection> dsRecords = manager.GetAllSections(this.Application.ApplicationId, sectionType).ToList();

            Assert.GreaterOrEqual(dsRecords.Count, records.Count);

            foreach (CMSSection record in records)
            {
                Assert.AreEqual(1, dsRecords.Count(c => c.CMSSectionId == record.CMSSectionId));
            }

            Assert.AreEqual(0, dsRecords.Count(c => c.CMSSectionType != sectionType));

            foreach (CMSSection record in records)
            {
                Delete(this.DataStore, record);
            }
        }
Beispiel #2
0
        public void Test_CreateUpdateDeleteSection()
        {
            CMSSectionManager manager = new CMSSectionManager(this.DataStore);
            CMSSection        record  = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, null, this.Random);

            CMSSection recordToCompare;

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

                manager.Update(record);
                record = manager.GetSection(record.CMSSectionType, record.CMSSectionId);

                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);
        }