示例#1
0
        public void Load()
        {
            NewModel();

            List <UnitSave> participants = new List <UnitSave>();

            for (int i = 0; i < 5; i++)
            {
                participants.Add(new UnitSave {
                    Id = i, Name = "test" + i, Group = MarriageGroup.Group1
                });
            }
            for (int i = 5; i < 10; i++)
            {
                participants.Add(new UnitSave {
                    Id = i, Name = "test" + i, Group = MarriageGroup.Group2
                });
            }

            MockPersistence mockPersistence = new MockPersistence
            {
                MockData = new SaveData
                {
                    Participants = participants
                }
            };

            _context.Persistence = mockPersistence;
            _context.Persistence.Load("");

            _model.Load();
            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(i, _context.Participants[i].ID);
                Assert.AreEqual("test" + i, _context.Participants[i].Name);
                Assert.AreEqual(i < 5 ? MarriageGroup.Group1 : MarriageGroup.Group2, _context.Participants[i].Group);
            }
            Assert.IsTrue(_context.ParticipantsChanged);
        }
 public void Load()
 {
     _model.Load();
     RefreshPage();
 }