예제 #1
0
        public async Task GetByCrewAndId_WithIncorrectCrewId_ShouldReturn404()
        {
            using (var context = provider.GetService <TimingSiteContext>())
                using (var controller = new HeadRaceTimingSite.Api.Controllers.PenaltyController(mapper, context))
                {
                    var result = await controller.GetByCrewAndId(1, 1).ConfigureAwait(false);

                    var notFoundResult = result as NotFoundResult;

                    Assert.IsNotNull(notFoundResult);
                    Assert.AreEqual(404, notFoundResult.StatusCode);
                }
        }
예제 #2
0
        public async Task GetByCrewAndId_WithIncorrectPenaltyId_ShouldReturn404()
        {
            using (var context = provider.GetService <TimingSiteContext>())
                using (var controller = new HeadRaceTimingSite.Api.Controllers.PenaltyController(mapper, context))
                {
                    Crew dbCrew = new Crew {
                        CrewId = 1, BroeCrewId = 123456
                    };
                    context.Crews.Add(dbCrew);
                    context.SaveChanges();

                    var result = await controller.GetByCrewAndId(123456, 1).ConfigureAwait(false);

                    var notFoundResult = result as NotFoundResult;

                    Assert.IsNotNull(notFoundResult);
                    Assert.AreEqual(404, notFoundResult.StatusCode);
                }
        }