示例#1
0
        public async Task ExcludeAllStudentsTestAsync()
        {
            var groupRepository = new FakeGroupRepository();
            var group           = await GroupBuilder.BuildAsync(groupRepository, 1);

            var studentRepository = new FakeStudentRepository();
            var student1          = await StudentBuilder.BuildAsync(studentRepository, 1);

            var student2 = await StudentBuilder.BuildAsync(studentRepository, 2);

            group.IncludeStudent(student1);
            Assert.AreEqual(true, group.ExcludeAllStudents());
            Assert.AreEqual(0, group.Grouping.Count);

            group.IncludeStudent(student2);
            Assert.AreEqual(true, group.ExcludeAllStudents());
            Assert.AreEqual(0, group.Grouping.Count);

            group.IncludeStudent(student1);
            group.IncludeStudent(student2);
            Assert.AreEqual(true, group.ExcludeAllStudents());
            Assert.AreEqual(0, group.Grouping.Count);
            Assert.AreEqual(false, group.ExcludeAllStudents());
            Assert.AreEqual(0, group.Grouping.Count);
        }
示例#2
0
        public async Task ExcludeFromAllGroupsTestAsync()
        {
            Assert.Fail("Has to be in integration tests");

            var groupRepository   = new FakeGroupRepository();
            var studentRepository = new FakeStudentRepository();

            var group1 = await GroupBuilder.BuildAsync(groupRepository, 1);

            var group2 = await GroupBuilder.BuildAsync(groupRepository, 2);

            var student = await StudentBuilder.BuildAsync(studentRepository, 1);

            group1.IncludeStudent(student);
            group2.IncludeStudent(student);

            Assert.AreEqual(true, student.ExcludeFromAllGroups());
            Assert.AreEqual(0, group1.Grouping.Count);
            Assert.AreEqual(0, group2.Grouping.Count);
        }
 public void Init()
 {
     repository = new FakeGroupRepository();
     subject = new TestGroupService("test", repository);
 }