Пример #1
0
        public void CgcTest_Store_ImportReplace()
        {
            AppDataModel dm = createTestDataModel12();

            ClassesGroupsCategoriesEditVM cge = new ClassesGroupsCategoriesEditVM(dm);

            cge.Clear();
            Assert.IsTrue(cge.DifferentToDataModel());
            cge.Import(createTestDataModel1());
            Assert.IsTrue(cge.DifferentToDataModel());

            cge.Store();
            Assert.IsFalse(cge.DifferentToDataModel());

            // Verify Data Model
            Assert.AreEqual(2, dm.GetParticipantCategories().Count);
            Assert.AreEqual("Männlich", dm.GetParticipantCategories()[0].PrettyName);
            Assert.AreEqual("Weiblich", dm.GetParticipantCategories()[1].PrettyName);

            Assert.AreEqual(2, dm.GetParticipantGroups().Count);
            Assert.AreEqual("G_U10", dm.GetParticipantGroups()[0].Name);
            Assert.AreEqual("G_U12", dm.GetParticipantGroups()[1].Name);

            Assert.AreEqual(4, dm.GetParticipantClasses().Count);
            Assert.AreEqual("U10", dm.GetParticipantClasses()[0].Name);
            Assert.AreEqual("U10", dm.GetParticipantClasses()[1].Name);
            Assert.AreEqual("U12", dm.GetParticipantClasses()[2].Name);
            Assert.AreEqual("U12", dm.GetParticipantClasses()[3].Name);
        }
Пример #2
0
        public void CgcTest_Load()
        {
            AppDataModel dm = createTestDataModel1();

            ClassesGroupsCategoriesEditVM cge = new ClassesGroupsCategoriesEditVM(dm);

            Assert.AreEqual(4, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(2, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);
        }
Пример #3
0
        public void CgcTest_Store_ManualEdit()
        {
            AppDataModel dm = createTestDataModel1();

            ClassesGroupsCategoriesEditVM cge = new ClassesGroupsCategoriesEditVM(dm);

            void checkAndStore()
            {
                Assert.IsTrue(cge.DifferentToDataModel());
                cge.Store();
                Assert.IsFalse(cge.DifferentToDataModel());
            }

            Assert.IsFalse(cge.DifferentToDataModel());

            // Per XXX add, modify, delete
            cge.CategoryViewModel.Items.Add(new ParticipantCategory('U', "Unbekannt", 2));
            checkAndStore();
            cge.CategoryViewModel.Items.RemoveAt(0);
            checkAndStore();
            cge.CategoryViewModel.Items[0].PrettyName = "WEIBLICH";
            checkAndStore();

            cge.GroupViewModel.Items.Add(new ParticipantGroup("xxx", "G_U14", 2));
            checkAndStore();
            cge.GroupViewModel.Items.RemoveAt(0);
            checkAndStore();
            cge.GroupViewModel.Items[0].Name = "B_U12";
            checkAndStore();

            cge.ClassViewModel.Items.Add(new ParticipantClass("xxx", cge.GroupViewModel.Items[1], "U14", cge.CategoryViewModel.Items[0], 2006, 0));
            checkAndStore();
            cge.ClassViewModel.Items.RemoveAt(0);
            checkAndStore();
            cge.ClassViewModel.Items[0].Name = "u10";
            checkAndStore();

            // Verify Data Model
            Assert.AreEqual(dm.GetParticipantCategories().Count, 2);
            Assert.AreEqual("WEIBLICH", dm.GetParticipantCategories()[0].PrettyName);
            Assert.AreEqual("Unbekannt", dm.GetParticipantCategories()[1].PrettyName);

            Assert.AreEqual(2, dm.GetParticipantGroups().Count);
            Assert.AreEqual("B_U12", dm.GetParticipantGroups()[0].Name);
            Assert.AreEqual("G_U14", dm.GetParticipantGroups()[1].Name);

            Assert.AreEqual(4, dm.GetParticipantClasses().Count);
            Assert.AreEqual("u10", dm.GetParticipantClasses()[0].Name);
            Assert.AreEqual("U12", dm.GetParticipantClasses()[1].Name);
            Assert.AreEqual("U12", dm.GetParticipantClasses()[2].Name);
            Assert.AreEqual("U14", dm.GetParticipantClasses()[3].Name);
        }
Пример #4
0
        public void CgcTest_ImportJoin()
        {
            AppDataModel dm = createTestDataModel1();

            ClassesGroupsCategoriesEditVM cge = new ClassesGroupsCategoriesEditVM(dm);

            Assert.AreEqual(4, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(2, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);

            cge.Import(createTestDataModel12());
            Assert.AreEqual(8, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(4, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);

            cge.Reset();
            Assert.AreEqual(4, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(2, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);
        }
Пример #5
0
        public void CgcTest_ClearAndReset()
        {
            AppDataModel dm = createTestDataModel1();

            ClassesGroupsCategoriesEditVM cge = new ClassesGroupsCategoriesEditVM(dm);

            Assert.AreEqual(4, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(2, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);

            cge.Clear();
            Assert.AreEqual(0, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(0, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(0, cge.CategoryViewModel.Items.Count);

            cge.Reset();
            Assert.IsFalse(cge.DifferentToDataModel());
            Assert.AreEqual(4, cge.ClassViewModel.Items.Count);
            Assert.AreEqual(2, cge.GroupViewModel.Items.Count);
            Assert.AreEqual(2, cge.CategoryViewModel.Items.Count);
        }