/// <summary>
 /// Constructor.
 /// </summary>
 public PushEventCommit(GitHubPushEvent pushEvent, Commit commit)
 {
     PushEvent = pushEvent;
     Commit = commit;
 }
		/// <summary>
		/// Returns the expected expression for CreateRepositoryAsync.
		/// </summary>
		private static Expression<Func<IPushEventProcessor, Task<string>>> GetCreateBuildJobExpression(
			GitHubPushEvent pushEvent)
		{
			return processor => processor.CreateBuildJobAsync
			(
				It.Is<Project>
				(
					project => project.Name == "Project1"	
				),
				It.Is<PushEventCommit>
				(
					pushEventCommit => pushEventCommit.PushEvent == pushEvent	
				),
				"BuildResultCallbackUrl"
			);
		}
		/// <summary>
		/// Returns a mock push event retriever.
		/// </summary>
		private Mock<IPushEventRetriever> GetMockPushEventRetriever(GitHubPushEvent pushEvent)
		{
			var pushEventRetriever = new Mock<IPushEventRetriever>();
			pushEventRetriever
				.Setup
				(
					retriever => retriever.GetAllPushEventsAsync
					(
						It.Is<Project>
						(
							project => project.Name == "Project1"
						),
						It.Is<IList<ClassroomMembership>>
						(
							students =>
								students.Count == 1
								&& students[0].GitHubTeam == "LastNameFirstName"
						)
					)
				)
				.Returns<Project, IList<ClassroomMembership>>
				(
					(project, students) => Task.FromResult<IList<StudentRepoPushEvents>>
					(
						Collections.CreateList
						(
							new StudentRepoPushEvents(students[0], Collections.CreateList(pushEvent))
						)
					)
				);

			return pushEventRetriever;
		}
		/// <summary>
		/// Returns a mock json serializer.
		/// </summary>
		private static Mock<IJsonSerializer> GetMockJsonSerializer(
			GitHubPushEvent pushEvent)
		{
			var jsonSerializer = new Mock<IJsonSerializer>();

			jsonSerializer
				.Setup(js => js.Deserialize<GitHubPushEvent>("SerializedPushEvent"))
				.Returns(pushEvent);

			return jsonSerializer;
		}
		/// <summary>
		/// Returns a mock push event processor.
		/// </summary>
		private Mock<IPushEventProcessor> GetMockPushEventProcessor(GitHubPushEvent pushEvent)
		{
			var pushEventProcessor = new Mock<IPushEventProcessor>();
			pushEventProcessor
				.Setup
				(
					processor => processor.GetNewCommitsToProcess
					(
						It.Is<Project>
						(
							project => project.Name == "Project1"
						),
						It.Is<ICollection<CommitDescriptor>>
						(
							existingCommits =>
								   existingCommits.Count == 2
								&& existingCommits.Any(c => c.Sha == "FirstCommitSha")
								&& existingCommits.Any(c => c.Sha == "SecondCommitSha")
						),
						It.Is<IList<StudentRepoPushEvents>>
						(
							events => 
								   events.Count == 1 
								&& events[0].PushEvents.Count == 1 
								&& events[0].PushEvents[0] == pushEvent	
						)
					)
				)
				.Returns<Project, ICollection<CommitDescriptor>, IList<StudentRepoPushEvents>>
				(
					(project, commits, pushEvents) => Collections.CreateList
					(
						new PushEventCommit
						(
							pushEvent,
							new Commit()
							{
								Sha = "NewCommitSha",
								PushDate = pushEvent.CreatedAt.UtcDateTime
							}
						)						
					)
				);

			pushEventProcessor
				.Setup(GetCreateBuildJobExpression(pushEvent))
				.ReturnsAsync("NewBuildJobId");

			return pushEventProcessor;
		}