static public bool ParseListPlayerResponse(byte[] responseBytes) { Player.PlayerListResponse listPlayersResponse = Deserialize(responseBytes, typeof(Player.PlayerListResponse)) as Player.PlayerListResponse; SenseixSession.SetSessionState(true); Logger.BasicLog("I got a response from a list Player Message"); if (listPlayersResponse.player.Count == 0) { throw new Exception("no players in player list"); } SenseixSession.SetCurrentPlayerList(listPlayersResponse); StudentSelection.UpdateStudentSelection(); return(true); }
public void IndividualTasksCorrect() { var groups = new[] { "1", "2" }; var scheduleUpdaterMock = new Mock <IScheduleUpdater>(); var selectionUpdaterMock = new Mock <IStudentSelectionUpdater>(); var lessonInfo1 = new LessonInfo { Subject = "l1", Group = "g1" }; var lessonInfo2 = new LessonInfo { Subject = "l2", Group = "g2" }; var lessonInfo3 = new LessonInfo { Subject = "l3", Group = "g1" }; scheduleUpdaterMock.Setup(x => x.UpdateSchedule(It.Is <string[]>(s => s == groups))) .Returns(new[] { lessonInfo1, lessonInfo2, lessonInfo3 }); var studentSelection1 = new StudentSelection { Group = "g1", Name = "name", SpecCourseName = lessonInfo3.Subject }; var studentSelection2 = new StudentSelection { Group = studentSelection1.Group, Name = studentSelection1.Name, SpecCourseName = lessonInfo1.Subject }; selectionUpdaterMock.Setup(x => x.Update()) .Returns(new List <StudentSelection> { studentSelection1, studentSelection2 }); var individualScheduleBuilder = new IndividualScheduleBuilder(scheduleUpdaterMock.Object, selectionUpdaterMock.Object); var updateIndividualSchedule = individualScheduleBuilder.UpdateIndividualSchedule(groups); Assert.That(updateIndividualSchedule.StudentsLessons.Count, Is.EqualTo(1)); Assert.That(updateIndividualSchedule.StudentsLessons, Contains.Key(studentSelection1.Name)); Assert.That(updateIndividualSchedule.StudentsLessons.First().Value.Lessons, Contains.Item(lessonInfo1)); Assert.That(updateIndividualSchedule.StudentsLessons.First().Value.Lessons, Contains.Item(lessonInfo3)); Assert.That(updateIndividualSchedule.GroupsLessons, Does.Not.ContainKey(lessonInfo1.Group)); Assert.That(updateIndividualSchedule.GroupsLessons, Contains.Key(lessonInfo2.Group)); Assert.That(updateIndividualSchedule.GroupsLessons.Count, Is.EqualTo(1)); CollectionAssert.AreEquivalent(new[] { lessonInfo2 }, updateIndividualSchedule.GroupsLessons[lessonInfo2.Group]); }