Beispiel #1
0
        public void Should_Be_Ok_When_Find_By_Accelartion_And_User(int accelerationId, int userId)
        {
            var fakes       = new Fakes();
            var fakeService = fakes.FakeChallengeService().Object;
            var expected    = fakeService.FindByAccelerationIdAndUserId(accelerationId, userId).
                              Select(x => fakes.Mapper.Map <ChallengeDTO>(x)).
                              ToList();

            var controller = new ChallengeController(fakeService, fakes.Mapper);
            var result     = controller.GetAll(accelerationId: accelerationId, userId: userId);

            Assert.IsType <OkObjectResult>(result.Result);
            var actual = (result.Result as OkObjectResult).Value as List <ChallengeDTO>;

            Assert.NotNull(actual);
            Assert.Equal(expected, actual, new ChallengeDTOIdComparer());
        }