コード例 #1
0
        public async Task RetrospectiveLobby_GroupingStage_CanMoveNote()
        {
            // Given
            int note1Id = 0, note2Id = 0, noteGroupId = 0, bossId = 0;

            using (IServiceScope scope = this.App.CreateTestServiceScope()) {
                await scope.TestCaseBuilder(this.RetroId).
                WithParticipant("Boss", true, "scrummaster").
                OutputId(id => bossId = id).
                WithParticipant("Josh", false).
                WithParticipant("Foo", false).
                WithParticipant("Bar", false).
                WithParticipant("Baz", false).
                WithRetrospectiveStage(RetrospectiveStage.Writing).
                WithNote(KnownNoteLane.Start, "Josh").
                OutputId(id => note1Id = id).
                WithNote(KnownNoteLane.Continue, "Boss").
                WithNote(KnownNoteLane.Continue, "Bar").
                WithNote(KnownNoteLane.Continue, "Baz").
                WithNote(KnownNoteLane.Stop, "Foo").
                WithNote(KnownNoteLane.Start, "Foo").
                OutputId(id => note2Id = id).
                WithNote(KnownNoteLane.Start, "Boss").
                WithRetrospectiveStage(RetrospectiveStage.Grouping).
                WithNoteGroup("Boss", KnownNoteLane.Continue, "Cont name").
                WithNoteGroup("Boss", KnownNoteLane.Start, "Some name").
                OutputId(id => noteGroupId = id).
                Build();
            }

            await Task.WhenAll(
                Task.Run(() => this.Join(this.Client1, true, "Boss", alreadyJoined: true)),
                Task.Run(() => this.Join(this.Client2, false, "Josh", true))
                );

            this.WaitNavigatedToLobby();

            // When

            /*{
             *  NoteLaneComponent noteLane = this.Client1.GetLane(KnownNoteLane.Start);
             *  NoteComponent note1 = noteLane.Notes.First(x => x.Id == note1Id);
             *  NoteComponent note2 = noteLane.Notes.First(x => x.Id == note2Id);
             *  NoteGroupComponent noteGroup = noteLane.NoteGroups.First(x => x.Id == noteGroupId);
             *
             *  this.Client1.WebDriver.ExecuteDragAndDrop(note1.WebElement, noteGroup.WebElement);
             *  this.Client1.WebDriver.ExecuteDragAndDrop(note2.WebElement, noteGroup.WebElement);
             * }*/// Disable while: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2695

            using (IServiceScope scope = this.App.CreateTestServiceScope()) {
                scope.SetAuthenticationInfo(new CurrentParticipantModel(bossId, "Boss", true));
                await scope.Send(new MoveNoteCommand(note1Id, noteGroupId));

                await scope.Send(new MoveNoteCommand(note2Id, noteGroupId));
            }

            // Then
            this.MultiAssert(client => {
                NoteLaneComponent noteLane   = client.GetLane(KnownNoteLane.Start);
                NoteGroupComponent noteGroup = noteLane.NoteGroups.First(x => x.Id == noteGroupId);

                Assert.That(() => noteGroup.Notes.Select(x => x.Id).ToArray(), Contains.Item(note1Id).And.Contain(note2Id).Retry());
            });
        }