public async Task <object> Post(RetrospectiveModel value) { Retrospective retro = RetrospectiveFactory.Create(value.Description, value.SelectedTemplate); ResourceResponse <Document> result = await repository.Save(retro); var manager = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>(); var identityUser = manager.FindById(HttpContext.Current.User.Identity.GetUserId()); if (identityUser.Retrospectives == null) { identityUser.Retrospectives = new List <RetrospectiveLocation>(); } identityUser.Retrospectives.Add(new RetrospectiveLocation() { Description = value.Description, CreatedOn = DateTime.UtcNow, Id = result.Resource.Id }); identityUser.PhoneNumberConfirmed = true; await manager.UpdateAsync(identityUser); return(new { id = result.Resource.Id }); }
public async Task CastVoteCommandHandler_NoteGroupVote_VoteSavedAndBroadcast() { // Given var securityValidator = Substitute.For <ISecurityValidator>(); var mediatorMock = Substitute.For <IMediator>(); var handler = new CastVoteCommandHandler( this.Context, this._currentParticipantService, securityValidator, mediatorMock, this.Mapper ); Retrospective retro = await this.CreateRetrospectiveWithNoteGroup(); CastVoteCommand command = CastVoteCommand.ForNoteGroup(retro.NoteGroup.First().Id, VoteMutationType.Added); // When await handler.Handle(command, CancellationToken.None); // Then await securityValidator.Received(). EnsureOperation(Arg.Any <Retrospective>(), SecurityOperation.AddOrUpdate, Arg.Any <NoteVote>()); var broadcastedNote = mediatorMock.ReceivedCalls().FirstOrDefault()?.GetArguments()[0] as VoteChangeNotification; if (broadcastedNote == null) { Assert.Fail("No broadcast has gone out"); } Assert.That(broadcastedNote.VoteChange.RetroId, Is.EqualTo(retro.UrlId.StringId)); Assert.That(broadcastedNote.VoteChange.Mutation, Is.EqualTo(VoteMutationType.Added)); Assert.That(broadcastedNote.VoteChange.Vote.NoteGroupId, Is.EqualTo(retro.NoteGroup.First().Id)); }
public ActionResult <RetroColumn> PostRetroColumn(RetroColumn retroColumn) { Retrospective retrospective = _context.Retrospectives.First(x => x.Id == retroColumn.RetrospectiveId); var decodedId = decoder.DecodeToken(Request != null ? (Request.Headers.ContainsKey("token") ? Request.Headers["token"].ToString() : null) : null); if (retrospective == null && retroColumn != null) { return(NotFound()); } if (decodedId == null || retrospective.RetroUserId != int.Parse(decodedId)) { return(Unauthorized()); } _context.SaveRetroColumn(retroColumn); if (_hubContext.Clients != null) { try { _hubContext.Clients.All.BroadcastMessage(true, retroColumn.RetrospectiveId); } catch (Exception e) { _hubContext.Clients.All.BroadcastMessage(false, retroColumn.RetrospectiveId); } } return(CreatedAtAction("GetRetroColumn", new { id = retroColumn.Id }, retroColumn)); }
public async Task RetrospectiveStatusMapper_ReturnsRetrospectiveInfo() { // Given var retro = new Retrospective { Title = "Yet another test", Participants = { new Participant { Name = "John", Color = Color.BlueViolet }, new Participant { Name = "Jane", Color = Color.Aqua }, }, HashedPassphrase = "abef", CurrentStage = RetrospectiveStage.Writing }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(CancellationToken.None); var mapper = new RetrospectiveStatusMapper(this.Context, this.Mapper); // When var result = await mapper.GetRetrospectiveStatus(retro, CancellationToken.None); // Then Assert.That(result.Lanes, Has.Count.EqualTo(3 /* Based on seed data */)); Assert.That(result.IsEditingNotesAllowed, Is.True); Assert.That(result.IsViewingOtherNotesAllowed, Is.False); Assert.That(result.RetroId, Is.EqualTo(retroId)); Assert.That(result.Title, Is.EqualTo(retro.Title)); }
public IActionResult PutRetrospective(Retrospective retrospective) { var decodedId = decoder.DecodeToken(Request != null ? Request.Headers["token"].ToString() : null); if (retrospective == null) { return(NotFound()); } if (decodedId == null || retrospective.RetroUserId != int.Parse(decodedId)) { return(Unauthorized()); } _context.SaveRetrospective(retrospective); if (hubContext.Clients != null) { try { hubContext.Clients.All.BroadcastMessage(true, retrospective.Id); } catch (Exception e) { hubContext.Clients.All.BroadcastMessage(false, retrospective.Id); } } return(NoContent()); }
//TODO - convert to Using public int insertRetro(Retrospective retro) { int ret = 0; MySqlCommand command = conn2.CreateCommand(); conn2.Open(); command.CommandText = "INSERT INTO Retrospective " + "VALUES (@id, @title, @typeId, @code);"; command.Parameters.AddWithValue("@id", retro.id); command.Parameters.AddWithValue("@title", retro.title); command.Parameters.AddWithValue("@typeId", retro.typeId); command.Parameters.AddWithValue("@code", retro.code); try { ret = command.ExecuteNonQuery(); } catch (InvalidOperationException) { ret = -1; } conn2.Close(); return(ret); }
public async Task GetParticipantsInfoCommand_ReturnsList_OnRetrospectiveFound() { // Given var retro = new Retrospective { Title = "What", Participants = { new Participant { Name = "John", Color = Color.BlueViolet }, new Participant { Name = "Jane", Color = Color.Aqua }, }, HashedPassphrase = "abef" }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(CancellationToken.None); var query = new GetParticipantsInfoQuery(retroId); var handler = new GetParticipantsInfoQueryHandler(this.Context, this.Mapper); // When var result = await handler.Handle(query, CancellationToken.None); // Then Assert.That(result.Participants, Is.Not.Empty); Assert.That(result.Participants.Select(x => x.Name), Contains.Item("John")); Assert.That(result.Participants.Select(x => x.Name), Contains.Item("Jane")); }
//TODO - convert to Using public int updateRetro(Retrospective retro) { MySqlCommand command = conn2.CreateCommand(); conn2.Open(); int ret = 0; command.CommandText = "UPDATE Retrospective " + "SET Title = @title,TypeId= @typeId,Code= @code " + "WHERE ID = @retroId"; command.Parameters.AddWithValue("@title", retro.title); command.Parameters.AddWithValue("@typeId", retro.typeId); command.Parameters.AddWithValue("@code", retro.code); command.Parameters.AddWithValue("@retroId", retro.id); try { ret = command.ExecuteNonQuery(); } catch (InvalidOperationException) { ret = -1; } conn2.Close(); return(ret); }
public ArrayList getAllRetros() { ArrayList retrospectives = new ArrayList(); Retrospective retro; using (var conn = new MySqlConnection("server=" + ip + ";database=SSG_POD;userid=" + username + ";password="******";")) using (var command = conn.CreateCommand()) { command.CommandText = "SELECT * FROM Retrospective;"; conn.Open(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { retro = new Retrospective(); retro.id = int.Parse(reader[0].ToString()); retro.title = reader[1].ToString(); retro.typeId = int.Parse(reader[2].ToString()); retro.code = reader[3].ToString(); retrospectives.Add(retro); } } } return(retrospectives); }
public async Task UpdateNoteGroupCommandHandler_InvalidId_ThrowsNotFoundException() { // Given var handler = new UpdateNoteGroupCommandHandler( this.Context, Substitute.For <ISecurityValidator>(), Substitute.For <IMediator>() ); var retro = new Retrospective { CurrentStage = RetrospectiveStage.Grouping, FacilitatorHashedPassphrase = "whatever", Title = TestContext.CurrentContext.Test.FullName, CreationTimestamp = DateTimeOffset.Now, Participants = { new Participant { Name = "John" } }, NoteGroup = { new NoteGroup { Lane = this.Context.NoteLanes.Find(KnownNoteLane.Continue), Title = "???" } } }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(); var command = new UpdateNoteGroupCommand(retroId, -1, "!!!"); // When TestDelegate action = () => handler.Handle(command, CancellationToken.None).GetAwaiter().GetResult(); // Then Assert.That(action, Throws.InstanceOf <NotFoundException>()); }
public async Task AddNoteCommandHandler_InvalidLaneId_ThrowsNotFoundException() { // Given var handler = new AddNoteCommandHandler( this.Context, this._currentParticipantService, Substitute.For <ISecurityValidator>(), Substitute.For <IMediator>(), this.Mapper, this._systemClock ); var retro = new Retrospective { CurrentStage = RetrospectiveStage.Writing, FacilitatorHashedPassphrase = "whatever", Title = TestContext.CurrentContext.Test.FullName, CreationTimestamp = DateTimeOffset.Now, Participants = { new Participant { Name = "John" } } }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(); var command = new AddNoteCommand(retroId, -1); // When TestDelegate action = () => handler.Handle(command, CancellationToken.None).GetAwaiter().GetResult(); // Then Assert.That(action, Throws.InstanceOf <NotFoundException>()); }
private Retrospective ThreeColumnTemplate(Retrospective retrospective) { var columns = new List <RetroColumn> { new RetroColumn { Title = "To do" }, new RetroColumn { Title = "Doing" }, new RetroColumn { Title = "Done" } }; foreach (RetroColumn r in columns) { retrospective.RetroColumns.Add(r); } return(retrospective); }
public async Task GetJoinRetrospectiveInfoCommandHandler_ReturnsInfo_OnRetrospectiveFound() { // Given var retrospective = new Retrospective { Title = "Hello", CreationTimestamp = DateTimeOffset.Now, HashedPassphrase = "hello" }; string retroId = retrospective.UrlId.StringId; this.Context.Retrospectives.Add(retrospective); await this.Context.SaveChangesAsync(CancellationToken.None); var handler = new GetJoinRetrospectiveInfoQueryHandler(this.Context, new NullLogger <GetJoinRetrospectiveInfoQueryHandler>()); var command = new GetJoinRetrospectiveInfoQuery { RetroId = retroId }; // When var result = await handler.Handle(command, CancellationToken.None); // Then Assert.That(result, Is.Not.Null); Assert.That(result.Title, Is.EqualTo("Hello")); Assert.That(result.IsStarted, Is.False); Assert.That(result.IsFinished, Is.False); Assert.That(result.NeedsParticipantPassphrase, Is.True); }
public async Task DeleteNoteGroupCommandHandler_InvalidId_SilentlyContinueNoBroadcast() { // Given var mediator = Substitute.For <IMediator>(); var handler = new DeleteNoteGroupCommandHandler( this.Context, Substitute.For <ISecurityValidator>(), Substitute.For <IMediator>() ); var retro = new Retrospective { CurrentStage = RetrospectiveStage.Grouping, FacilitatorHashedPassphrase = "whatever", Title = TestContext.CurrentContext.Test.FullName, CreationTimestamp = DateTimeOffset.Now, Participants = { new Participant { Name = "John" } }, NoteGroup = { new NoteGroup { Lane = this.Context.NoteLanes.Find(KnownNoteLane.Continue), Title = "???" } } }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(); var command = new DeleteNoteGroupCommand(retroId, -1); // When await handler.Handle(command, CancellationToken.None); // Then Assert.That(mediator.ReceivedCalls(), Is.Empty); }
public void SaveRetrospective(Retrospective retrospective) { if (retrospective.Id == 0) { _context.Retrospectives.Add(retrospective); } else { Retrospective dbEntry = _context.Retrospectives .FirstOrDefault(c => c.Id == retrospective.Id); if (dbEntry != null) { dbEntry.Title = retrospective.Title; dbEntry.CreatedDate = retrospective.CreatedDate; dbEntry.Description = retrospective.Description; dbEntry.RetroUserId = retrospective.RetroUserId; foreach (RetroColumn r in retrospective.RetroColumns) { this.SaveRetroColumn(r); } } } _context.SaveChanges(); }
private async Task <Retrospective> CreateRetrospectiveWithNote() { var retro = new Retrospective { CurrentStage = RetrospectiveStage.Writing, FacilitatorHashedPassphrase = "whatever", Title = TestContext.CurrentContext.Test.FullName, CreationTimestamp = DateTimeOffset.Now, Participants = { new Participant { Name = "John" } }, Notes = { new Note { Lane = this.Context.NoteLanes.Find(KnownNoteLane.Continue), Text = "???" } } }; Note note = retro.Notes.First(); note.Participant = retro.Participants.First(); string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(); TestContext.WriteLine(retroId); return(retro); }
public async Task <GetVotesQueryResult> Handle(GetVotesQuery request, CancellationToken cancellationToken) { if (request == null) { throw new ArgumentNullException(nameof(request)); } Retrospective retrospective = await this._returnDbContext.Retrospectives.AsNoTracking().FindByRetroId(request.RetroId, cancellationToken); if (retrospective == null) { throw new NotFoundException(nameof(Retrospective), request.RetroId); } List <Participant> participants = await this._returnDbContext.Participants.AsNoTracking(). Where(x => x.Retrospective.UrlId.StringId == request.RetroId). ToListAsync(cancellationToken); List <NoteLane> lanes = await this._returnDbContext.NoteLanes.ToListAsync(cancellationToken); int numberOfVotesPerLane = retrospective.Options.MaximumNumberOfVotes; int numberOfVotes = lanes.Count * numberOfVotesPerLane; ILookup <int, NoteVote> votes = this._returnDbContext.NoteVotes.AsNoTracking() .Include(x => x.Participant) .Include(x => x.Note) .Include(x => x.Note.Lane) .Include(x => x.NoteGroup) .Include(x => x.NoteGroup.Lane) .Where(x => x.Retrospective.UrlId.StringId == request.RetroId) .AsEnumerable() .ToLookup(x => x.Participant.Id, x => x); var result = new RetrospectiveVoteStatus(numberOfVotesPerLane); foreach (Participant participant in participants) { int votesCast = 0; foreach (NoteVote noteVote in votes[participant.Id]) { result.Votes.Add(this._mapper.Map <VoteModel>(noteVote)); votesCast++; } int votesLeft = numberOfVotes - votesCast; for (int v = 0; v < votesLeft; v++) { result.Votes.Add(new VoteModel { ParticipantId = participant.Id, ParticipantColor = this._mapper.Map <ColorModel>(participant.Color), ParticipantName = participant.Name }); } } result.Initialize(); return(new GetVotesQueryResult(result)); }
public static async Task SetRetrospective(this IServiceScope scope, string retroId, Action <Retrospective> action) { var dbContext = scope.ServiceProvider.GetRequiredService <IReturnDbContext>(); Retrospective retrospective = await dbContext.Retrospectives.FindByRetroId(retroId, CancellationToken.None); action.Invoke(retrospective); await dbContext.SaveChangesAsync(CancellationToken.None); }
private static async void AssertSave(IDocumentRepository <Retrospective> context) { Retrospective item = CreateItem(); await context.Save(item); IEnumerable <Retrospective> result = context.Get(); Assert.AreEqual(1, result.Count()); }
public async Task <RetrospectiveLaneContent> Handle(GetRetrospectiveLaneContentQuery request, CancellationToken cancellationToken) { if (request == null) { throw new ArgumentNullException(nameof(request)); } Retrospective retrospective = await this._returnDbContext.Retrospectives.AsNoTracking().FindByRetroId(request.RetroId, cancellationToken); var laneId = (KnownNoteLane)request.LaneId; var lane = new RetrospectiveLaneContent(); { IOrderedQueryable <Note> query = from note in this._returnDbContext.Notes where note.Retrospective.UrlId.StringId == request.RetroId where note.Lane.Id == laneId orderby note.CreationTimestamp select note; lane.Notes.AddRange( await query.ProjectTo <RetrospectiveNote>(this._mapper.ConfigurationProvider).ToListAsync(cancellationToken) ); } { IQueryable <NoteGroup> query = from retro in this._returnDbContext.Retrospectives where retro.UrlId.StringId == request.RetroId from noteGroup in retro.NoteGroup where noteGroup.Lane.Id == laneId orderby noteGroup.Id select noteGroup; lane.Groups.AddRange( await query.ProjectTo <RetrospectiveNoteGroup>(this._mapper.ConfigurationProvider).ToListAsync(cancellationToken) ); } int currentUserId = (await this._currentParticipantService.GetParticipant().ConfigureAwait(false)).Id; foreach (RetrospectiveNote note in lane.Notes) { note.IsOwnedByCurrentUser = currentUserId == note.ParticipantId; if (retrospective.CurrentStage < RetrospectiveStage.Discuss && !note.IsOwnedByCurrentUser) { if (note.Text != null) { note.Text = this._textAnonymizingService.AnonymizeText(note.Text); } } } this._mapper.Map <ICollection <RetrospectiveNote>, ICollection <RetrospectiveNoteGroup> >(lane.Notes, lane.Groups); return(lane); }
private void retroComboBox_SelectedIndexChanged(object sender, EventArgs e) { int i = retroComboBox.SelectedIndex; Retrospective selRetro = (Retrospective)retroComboBox.SelectedItem; clearAveragesTBs(); clearPodInfoTBs(); writeRetroInfo(selRetro); loadRetroItems(selRetro); }
private async void AssertQuery(IDocumentRepository <Retrospective> context) { Retrospective item = CreateItem(); item.Description = "SearchString"; await context.Save(item); IEnumerable <Retrospective> result = context.Get(r => r.Description == "SearchString"); Assert.AreEqual(1, result.Count()); }
public async Task DeleteNoteGroupCommandHandler_ValidCommand_CreatesValidObjectAndBroadcast() { // Given var securityValidator = Substitute.For <ISecurityValidator>(); var mediatorMock = Substitute.For <IMediator>(); var handler = new DeleteNoteGroupCommandHandler( this.Context, securityValidator, mediatorMock ); var retro = new Retrospective { CurrentStage = RetrospectiveStage.Writing, FacilitatorHashedPassphrase = "whatever", Title = TestContext.CurrentContext.Test.FullName, CreationTimestamp = DateTimeOffset.Now, Participants = { new Participant { Name = "John" } }, NoteGroup = { new NoteGroup { Lane = this.Context.NoteLanes.Find(KnownNoteLane.Continue), Title = "???" } } }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(); NoteGroup noteGroup = retro.NoteGroup.First(); var command = new DeleteNoteGroupCommand(retroId, noteGroup.Id); // When Assume.That(this.Context.NoteGroups.Select(x => x.Id), Does.Contain(noteGroup.Id)); await handler.Handle(command, CancellationToken.None); // Then await securityValidator.Received().EnsureOperation(Arg.Is <Retrospective>(r => r.Id == retro.Id), SecurityOperation.AddOrUpdate, Arg.Is <NoteGroup>(g => g.Id == noteGroup.Id)); var broadcastedDelete = mediatorMock.ReceivedCalls().FirstOrDefault()?.GetArguments()[0] as NoteLaneUpdatedNotification; if (broadcastedDelete == null) { Assert.Fail("No broadcast has gone out"); } Assert.That(broadcastedDelete.LaneId, Is.EqualTo((int)KnownNoteLane.Continue)); Assert.That(broadcastedDelete.RetroId, Is.EqualTo(command.RetroId)); Assert.That(broadcastedDelete.GroupId, Is.EqualTo(noteGroup.Id)); Assert.That(this.Context.NoteGroups.Select(x => x.Id), Does.Not.Contains(noteGroup.Id)); }
[Test] public void NoDate() { Retrospective hasDate = Instance.Create.Retrospective("Has Date", SandboxProject); Retrospective noDate = Instance.Create.Retrospective("No Date", SandboxProject); DateTime expectedDate = DateTime.Now.Date; hasDate.Date = expectedDate; hasDate.Save(); TestDate(noDate, hasDate, null); }
[Test] public void NoTeam() { Retrospective hasTeam = SandboxProject.CreateRetrospective("Has Team"); Retrospective noTeam = SandboxProject.CreateRetrospective("No Team"); Team expectedTeam = Instance.Create.Team("Team" + SandboxName); hasTeam.Team = expectedTeam; hasTeam.Save(); TestTeam(noTeam, hasTeam, null); }
[Test] public void NoIteration() { Retrospective scheduled = SandboxProject.CreateRetrospective("Has Iteration"); Retrospective notScheduled = SandboxProject.CreateRetrospective("No Iteration"); Iteration iteration = SandboxProject.CreateIteration(); scheduled.Iteration = iteration; scheduled.Save(); TestIteration(notScheduled, scheduled, null); }
[Test] public void NoFacilitatedBy() { Retrospective facilitated = Instance.Create.Retrospective("Has FacilitatedBy", SandboxProject); Retrospective notFacilitated = Instance.Create.Retrospective("No FacilitatedBy", SandboxProject); Member facilitator = GetAFacilitator(); facilitated.FacilitatedBy = facilitator; facilitated.Save(); TestFacilitatedBy(notFacilitated, facilitated, null); }
public void CleanRetrospective(Retrospective retrospective) { foreach (var rc in retrospective.RetroColumns) { foreach (var rf in rc.RetroFamilies.ToList()) { RemoveRetroFamily(rf); } rc.RetroCards.Clear(); } _context.SaveChanges(); }
public async Task <RetrospectiveNote> Handle(AddNoteCommand request, CancellationToken cancellationToken) { if (request == null) { throw new ArgumentNullException(nameof(request)); } // Get the required entities using IReturnDbContext returnDbContext = this._returnDbContextFactory.CreateForEditContext(); Retrospective retrospective = await returnDbContext.Retrospectives.FindByRetroId(request.RetroId, cancellationToken); if (retrospective == null) { throw new NotFoundException(nameof(Retrospective), request.RetroId); } NoteLane noteLane = await returnDbContext.NoteLanes.FindAsync((KnownNoteLane)request.LaneId); if (noteLane == null) { throw new NotFoundException(nameof(NoteLane), (KnownNoteLane)request.LaneId); } // Save the note CurrentParticipantModel currentParticipant = await this._currentParticipantService.GetParticipant(); var note = new Note { Retrospective = retrospective, CreationTimestamp = this._systemClock.CurrentTimeOffset, Lane = noteLane, Participant = await returnDbContext.Participants.FindAsync(currentParticipant.Id), ParticipantId = currentParticipant.Id, Text = String.Empty }; await this._securityValidator.EnsureOperation(retrospective, SecurityOperation.AddOrUpdate, note); returnDbContext.Notes.Add(note); await returnDbContext.SaveChangesAsync(cancellationToken); // Return and broadcast var broadcastNote = this._mapper.Map <RetrospectiveNote>(note); var returnNote = this._mapper.Map <RetrospectiveNote>(note); returnNote.IsOwnedByCurrentUser = true; // ... Broadcast await this._mediator.Publish(new NoteAddedNotification(request.RetroId, request.LaneId, broadcastNote), cancellationToken); return(returnNote); }
[Test] public void Date() { Retrospective hasDate = Instance.Create.Retrospective("Has Date", SandboxProject); Retrospective noDate = Instance.Create.Retrospective("No Date", SandboxProject); DateTime expectedDate = DateTime.Now; hasDate.Date = expectedDate; expectedDate = expectedDate.Date; // round to nearest day, as we'd expect Mort to. hasDate.Save(); TestDate(hasDate, noDate, expectedDate); }
void TestIteration(Retrospective expected, Retrospective not, Iteration expectedIteration) { RetrospectiveFilter filter = new RetrospectiveFilter(); filter.Project.Add(SandboxProject); filter.Iteration.Add(expectedIteration); ResetInstance(); expectedIteration = (expectedIteration != null) ? Instance.Get.IterationByID(expectedIteration.ID) : null; expected = Instance.Get.RetrospectiveByID(expected.ID); not = Instance.Get.RetrospectiveByID(not.ID); ICollection<Retrospective> results = SandboxProject.GetRetrospectives(filter); Assert.IsTrue(FindRelated(expected, results), "Expected to find Retrospective that matched filter."); Assert.IsFalse(FindRelated(not, results), "Expected to NOT find Retrospective that doesn't match filter."); foreach (Retrospective result in results) Assert.AreEqual(expectedIteration, result.Iteration); }
void TestDate(Retrospective expected, Retrospective not, DateTime? expectedDate) { RetrospectiveFilter filter = new RetrospectiveFilter(); filter.Project.Add(SandboxProject); filter.Date.Add(expectedDate); ResetInstance(); expected = Instance.Get.RetrospectiveByID(expected.ID); not = Instance.Get.RetrospectiveByID(not.ID); ICollection<Retrospective> results = SandboxProject.GetRetrospectives(filter); Assert.IsTrue(FindRelated(expected, results), "Expected to find Retrospective that matched filter."); Assert.IsFalse(FindRelated(not, results), "Expected to NOT find Retrospective that doesn't match filter."); foreach (Retrospective result in results) Assert.AreEqual(expectedDate, result.Date); }
void TestFacilitatedBy(Retrospective expected, Retrospective not, Member expectedFacilitator) { RetrospectiveFilter filter = new RetrospectiveFilter(); filter.Project.Add(SandboxProject); filter.FacilitatedBy.Add(expectedFacilitator); ResetInstance(); expectedFacilitator = (expectedFacilitator != null) ? Instance.Get.MemberByID(expectedFacilitator.ID) : null; expected = Instance.Get.RetrospectiveByID(expected.ID); not = Instance.Get.RetrospectiveByID(not.ID); ICollection<Retrospective> results = SandboxProject.GetRetrospectives(filter); Assert.IsTrue(FindRelated(expected, results), "Expected to find Retrospective that matched filter."); Assert.IsFalse(FindRelated(not, results), "Expected to NOT find Retrospective that doesn't match filter."); foreach (Retrospective result in results) Assert.AreEqual(expectedFacilitator, result.FacilitatedBy); }