Esempio n. 1
0
        public void ItUpdatesGamingGroupPublicDetails()
        {
            var request = new GamingGroupEditRequest
            {
                PublicDescription = "Description",
                Website = "http://Website.com"
            };
            var httpStatusCodeResult = autoMocker.ClassUnderTest.Edit(request, currentUser) as HttpStatusCodeResult;

            autoMocker.Get<IGamingGroupSaver>().AssertWasCalled(x => x.UpdatePublicGamingGroupDetails(request, currentUser));
        }
        public void ItUpdatesTheGamingGroup()
        {
            //--Arrange
            var request = new GamingGroupEditRequest
            {
                PublicDescription = "Description",
                Website = "Website",
                GamingGroupName = "some gaming group name",
                GamingGroupId = currentUser.CurrentGamingGroupId
            };

            //--Act
            autoMocker.ClassUnderTest.UpdatePublicGamingGroupDetails(request, currentUser);

            //--Assert
            autoMocker.Get<IDataContext>().FindById<GamingGroup>(currentUser.CurrentGamingGroupId);
            autoMocker.Get<IDataContext>().AssertWasCalled(x => x.Save(Arg<GamingGroup>.Matches(
                gamingGroup => gamingGroup.Name == request.GamingGroupName
                  && gamingGroup.PublicDescription == request.PublicDescription
                  && gamingGroup.PublicGamingGroupWebsite == request.Website.ToString()),
                Arg<ApplicationUser>.Is.Same(currentUser)));
        }
        public virtual ActionResult Edit(GamingGroupEditRequest request, ApplicationUser currentUser)
        {
            if (ModelState.IsValid)
            {
                this.gamingGroupSaver.UpdatePublicGamingGroupDetails(request, currentUser);

                return RedirectToAction(MVC.GamingGroup.Details(currentUser.CurrentGamingGroupId, currentUser));
            }

            return (this.Edit(request.GamingGroupId));
        }
Esempio n. 4
0
        public GamingGroup UpdatePublicGamingGroupDetails(GamingGroupEditRequest request, ApplicationUser currentUser)
        {
            var gamingGroup = dataContext.FindById<GamingGroup>(request.GamingGroupId);

            gamingGroup.PublicGamingGroupWebsite = request.Website;
            gamingGroup.PublicDescription = request.PublicDescription;
            gamingGroup.Name = request.GamingGroupName;

            gamingGroup = dataContext.Save(gamingGroup, currentUser);
            dataContext.CommitAllChanges();

            eventTracker.TrackGamingGroupUpdate(currentUser);

            return gamingGroup;
        }