public async Task PrivacyLevelER_TestGetNewPrivacyLevelER() { var privacyLevel = await PrivacyLevelER.NewPrivacyLevelER(); Assert.NotNull(privacyLevel); Assert.False(privacyLevel.IsValid); }
public async Task PrivacyLevelER_TestInvalidSavePrivacyLevelER() { var privacyLevel = await PrivacyLevelER.NewPrivacyLevelER(); privacyLevel.Description = String.Empty; PrivacyLevelER savedPrivacyLevel = null; Assert.False(privacyLevel.IsValid); Assert.Throws <Csla.Rules.ValidationException>(() => savedPrivacyLevel = privacyLevel.Save()); }
public async Task PrivacyLevelER_TestDescriptionRequired() { var privacyLevel = await PrivacyLevelER.NewPrivacyLevelER(); privacyLevel.Description = "make valid"; var isObjectValidInit = privacyLevel.IsValid; privacyLevel.Description = string.Empty; Assert.NotNull(privacyLevel); Assert.True(isObjectValidInit); Assert.False(privacyLevel.IsValid); }
public async Task PrivacyLevelER_TestInsertNewPrivacyLevelER() { var privacyLevel = await PrivacyLevelER.NewPrivacyLevelER(); privacyLevel.Description = "Standby"; privacyLevel.Notes = "This person is on standby"; var savedPrivacyLevel = await privacyLevel.SaveAsync(); Assert.NotNull(savedPrivacyLevel); Assert.IsType <PrivacyLevelER>(savedPrivacyLevel); Assert.True(savedPrivacyLevel.Id > 0); }
public async Task PrivacyLevelER_TestDescriptionExceedsMaxLengthOf50() { var privacyLevel = await PrivacyLevelER.NewPrivacyLevelER(); privacyLevel.Description = "valid length"; Assert.True(privacyLevel.IsValid); 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("Description", privacyLevel.BrokenRulesCollection[0].Property); Assert.Equal("Description can not exceed 255 characters", privacyLevel.BrokenRulesCollection[0].Description); }