public void AddCharacterViewModelWithConditionalField() { var field = _mock.CreateConditionalField(new ProjectField(), _mock.Group); var vm = new AddCharacterViewModel().Fill(_mock.Group, _mock.Master.UserId); var fieldView = vm.Fields.Field(field); fieldView.ShouldNotBeNull(); fieldView.Value.ShouldBeNull(); fieldView.ShouldBeHidden(); fieldView.ShouldBeEditable(); }
public CustomFieldsExtensionsTest() { var conditionalHeader = projectMock.CreateConditionalHeader(); var conditionalField = projectMock.CreateConditionalField(); allFieldsExceptMasterOnly = new[] { projectMock.CharacterField, projectMock.PublicField, projectMock.HideForUnApprovedClaim, conditionalField, conditionalHeader, }; allFields = allFieldsExceptMasterOnly .Union(new[] { projectMock.MasterOnlyField }) .ToArray(); }
public void ConditionalFieldChangeTestForGroup() { _original = new MockedProject(); _generator = new MockedFieldDefaultValueGenerator(); var mock = new MockedProject(); var claim = mock.CreateClaim(mock.Group, mock.Player); var conditionalField = mock.CreateConditionalField(); FieldSaveHelper.SaveCharacterFields( mock.Player.UserId, claim, new Dictionary <int, string>() { { conditionalField.ProjectFieldId, "test" }, }, _generator); ShouldBeTestExtensions.ShouldBe(claim.JsonData, $"{{\"{conditionalField.ProjectFieldId}\":\"test\"}}"); ShouldBeTestExtensions.ShouldBe(mock.Character.JsonData, _original.Character.JsonData, "Adding claim should not modify any character fields"); }