Пример #1
0
        public ActionResult RemoveSport(string sportName)
        {
            var request = new RemoveSportFromProfileRequest {ProfileId = GetProfileFromCookie(), SportName = sportName};

            var handler = new RemoveSportFromProfileRequestHandler(new ProfileRepository());

            handler.Handle(request);

            return RedirectToAction("SetupOptions", CreateSetupOptionsModel());
        }
        public void CanRemoveSPortsFromProfile()
        {
            var request = new RemoveSportFromProfileRequest {ProfileId = "ProfileId", SportName = "Soccer"};
            var profileRepo = new Mock<IProfileRepository>();
            profileRepo.Setup(x => x.RemoveSportFromProfile(request.ProfileId, request.SportName));

            var handler = new RemoveSportFromProfileRequestHandler(profileRepo.Object);

            var response = handler.Handle(request);

            profileRepo.Verify(x => x.RemoveSportFromProfile(request.ProfileId, request.SportName));
            Assert.That(response.Status, Is.EqualTo(ResponseCodes.Success));
        }