Ejemplo n.º 1
0
        public ActionResult RemoveLocation(string locationName)
        {
            var request = new RemoveLocationFromProfileRequest { ProfileId = GetProfileFromCookie(), LocationName = locationName };

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

            handler.Handle(request);

            return RedirectToAction("SetupOptions", CreateSetupOptionsModel());
        }
        public void CanRemoveLocationFromProfile()
        {
            var request = new RemoveLocationFromProfileRequest {ProfileId = "ProfileId", LocationName = "Bend"};
            var profileRepo = new Mock<IProfileRepository>();
            profileRepo.Setup(x => x.RemoveLocationFromProfile(request.ProfileId, request.LocationName));

            var handler = new RemoveLocationFromProfileRequestHandler(profileRepo.Object);

            var response = handler.Handle(request);

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