Esempio n. 1
0
        public void ShowPublicFieldToAnonEvenIfEditDisabled()
        {
            MockedProject.AssignFieldValues(Mock.Character, new FieldWithValue(Mock.PublicField, "1"));

            var vm          = new CustomFieldsViewModel(currentUserId: null, character: Mock.Character, disableEdit: true);
            var publicField = vm.FieldById(Mock.PublicField.ProjectFieldId);

            publicField.ShouldNotBeNull();
            publicField.CanView.ShouldBeTrue();
        }
Esempio n. 2
0
        public void AllowShadowCharacterFieldsTest()
        {
            var mock  = new MockedProject();
            var claim = mock.CreateClaim(mock.Character, mock.Player);

            MockedProject.AssignFieldValues(claim, new FieldWithValue(mock.CharacterField, "test"));

            var vm = new CustomFieldsViewModel(mock.Player.UserId, claim);

            var characterField = vm.FieldById(mock.CharacterField.ProjectFieldId);

            characterField.ShouldNotBeNull();
            characterField.ShouldBeHidden();
            characterField.Value.ShouldBe("test");

            characterField.ShouldBeEditable();
        }
Esempio n. 3
0
        public void MasterHiddenChangeTest()
        {
            _original  = new MockedProject();
            _generator = new MockedFieldDefaultValueGenerator();
            var mock        = new MockedProject();
            var publicField = new FieldWithValue(mock.PublicField, "Public");

            MockedProject.AssignFieldValues(mock.Character, publicField);
            FieldSaveHelper.SaveCharacterFields(
                mock.Master.UserId,
                mock.Character,
                new Dictionary <int, string>()
            {
                { mock.HideForUnApprovedClaim.ProjectFieldId, "test" },
                { mock.CharacterField.ProjectFieldId, null },
            },
                _generator);

            mock.Character.FieldValuesShouldBe(new FieldWithValue(mock.HideForUnApprovedClaim, "test"), publicField);
        }
Esempio n. 4
0
        public void ApprovedClaimHiddenChangeTest()
        {
            _original  = new MockedProject();
            _generator = new MockedFieldDefaultValueGenerator();
            var mock  = new MockedProject();
            var claim = mock.CreateApprovedClaim(mock.Character, mock.Player);

            var publicField = new FieldWithValue(mock.PublicField, "Public");

            MockedProject.AssignFieldValues(claim, publicField);

            FieldSaveHelper.SaveCharacterFields(
                mock.Player.UserId,
                claim,
                new Dictionary <int, string>()
            {
                { mock.HideForUnApprovedClaim.ProjectFieldId, "test" },
                { mock.CharacterField.ProjectFieldId, null },
            },
                _generator);

            mock.Character.FieldValuesShouldBe(new FieldWithValue(mock.HideForUnApprovedClaim, "test"), publicField);
            ShouldBeTestExtensions.ShouldBe(claim.JsonData, "{}");
        }