public void Should_Return_Right_Score_When_Find_By_Challenge_Id(int challengeId) { _contextoFake.FillWithAll(); var scoreEsperado = _contextoFake.GetFakeData <Submission>() .Where(x => x.ChallengeId == challengeId).Select(x => x.Score).Max(x => x); var scoreReal = _submissionService.FindHigherScoreByChallengeId(challengeId); Assert.Equal(scoreEsperado, scoreReal); }
public void FindHigherScoreByChallengeIdTeste_Return_Right(int challengeId, decimal expectedMaxScore) { var fakeContext = new FakeContext("FindHigherScoreByChallengeId"); fakeContext.FillWith<Submission>(); fakeContext.FillWith<Models.Challenge>(); using (var context = new CodenationContext(fakeContext.FakeOptions)) { var service = new SubmissionService(context); var actual = service.FindHigherScoreByChallengeId(challengeId); Assert.Equal(expectedMaxScore, actual); } }
public void Should_Be_Higher_Score_When_Get_By_Challenge_Id(int challengeId) { var fakeContext = new FakeContext("HigherSubmissionByChallenge"); fakeContext.FillWithAll(); using (var context = new CodenationContext(fakeContext.FakeOptions)) { var expected = fakeContext.GetFakeData <Submission>(). Where(challenge => challenge.ChallengeId == challengeId). Max(challenge => challenge.Score); var service = new SubmissionService(context); var actual = service.FindHigherScoreByChallengeId(challengeId); Assert.Equal(expected, actual); } }