public void CanEnsureCodeCreationIsValid() { Code codeFromForm = new Code(); ViewResult result = controller.Create(codeFromForm).AssertViewRendered(); result.ViewData.Model.ShouldNotBeNull(); result.ViewData.Model.ShouldBeOfType(typeof(CodesController.CodeFormViewModel)); }
public void CanCompareCodes() { Code instance = new Code(); instance.Name = "New Code"; Code instanceToCompareTo = new Code(); instanceToCompareTo.Name = "New Code"; instance.ShouldEqual(instanceToCompareTo); }
public static Team AcceptCode(this Team team, Code code, DateTime acceptTime) { team.TeamGameState.ActiveTaskState.AcceptedCodes.Add(new AcceptedCode { AcceptTime = acceptTime, Code = code, TeamTaskState = team.TeamGameState.ActiveTaskState }); return team; }
/// <summary> /// Creates a valid, transient Code; typical of something retrieved back from a form submission /// </summary> private static Code CreateTransientCode() { Code code = new Code() { Name = "New Code", Danger = "1", Task = new Task() }; return code; }
private void TransferFormValuesTo(Code codeToUpdate, Code codeFromForm) { codeToUpdate.Name = codeFromForm.Name; codeToUpdate.Danger = codeFromForm.Danger; codeToUpdate.IsBonus = codeFromForm.IsBonus; codeToUpdate.TipAfterCode = codeFromForm.TipAfterCode; codeToUpdate.Task = codeFromForm.Task; }