コード例 #1
0
        public async Task PrivacyLevelEdit_New()
        {
            var privacyLevel = await PrivacyLevelEdit.NewPrivacyLevelEdit();

            Assert.NotNull(privacyLevel);
            Assert.False(privacyLevel.IsValid);
        }
コード例 #2
0
        public async Task PrivacyLevelEdit_TestInvalidSave()
        {
            var privacyLevel = await PrivacyLevelEdit.NewPrivacyLevelEdit();

            privacyLevel.Description = String.Empty;

            Assert.False(privacyLevel.IsValid);
            await Assert.ThrowsAsync <ValidationException>(() => privacyLevel.SaveAsync());
        }
コード例 #3
0
        public async Task PrivacyLevelEdit_DescriptionRequired()
        {
            var privacyLevel = await PrivacyLevelEdit.NewPrivacyLevelEdit();

            privacyLevel.Description = "make valid";
            var isObjectValidInit = privacyLevel.IsValid;

            privacyLevel.Description = string.Empty;

            Assert.NotNull(privacyLevel);
            Assert.True(isObjectValidInit);
            Assert.False(privacyLevel.IsValid);
        }
コード例 #4
0
        public async void PrivacyLevelEdit_Insert()
        {
            var privacyLevel = await PrivacyLevelEdit.NewPrivacyLevelEdit();

            privacyLevel.Description = "Standby";
            privacyLevel.Notes       = "This person is inserted";

            var savedPrivacyLevel = await privacyLevel.SaveAsync();

            Assert.NotNull(savedPrivacyLevel);
            Assert.IsType <PrivacyLevelEdit>(savedPrivacyLevel);
            Assert.True(savedPrivacyLevel.Id > 0);
            Assert.NotNull(savedPrivacyLevel.RowVersion);
        }
コード例 #5
0
        public async Task PrivacyLevelEdit_DescriptionExceedsMaxLengthOf50()
        {
            var privacyLevel = await PrivacyLevelEdit.NewPrivacyLevelEdit();

            privacyLevel.Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
                                       "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
                                       "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " +
                                       "Duis aute irure dolor in reprehenderit";

            Assert.NotNull(privacyLevel);
            Assert.False(privacyLevel.IsValid);
            Assert.Equal("The field Description must be a string or array type with a maximum length of '50'.",
                         privacyLevel.BrokenRulesCollection[0].Description);
        }