public async void OrganizationTypeER_GetNewObject() { var organizationType = await OrganizationTypeER.NewOrganizationTypeER(); Assert.NotNull(organizationType); Assert.False(organizationType.IsValid); }
public async Task OrganizationTypeER_TestInvalidSave() { var organizationType = await OrganizationTypeER.NewOrganizationTypeER(); organizationType.Name = String.Empty; Assert.False(organizationType.IsValid); Assert.Throws <Csla.Rules.ValidationException>(() => organizationType.Save()); }
public async Task OrganizationTypeER_NameRequired() { var organizationType = await OrganizationTypeER.NewOrganizationTypeER(); organizationType.Name = "valid name"; organizationType.CategoryOfOrganization = await CategoryOfOrganizationEC.NewCategoryOfOrganizationEC(); organizationType.CategoryOfOrganization.Category = "category name"; var isObjectValidInit = organizationType.IsValid; organizationType.Name = String.Empty; Assert.NotNull(organizationType); Assert.True(isObjectValidInit); Assert.False(organizationType.IsValid); }
public async Task OrganizationTypeER_InsertNewObjectIntoDatabase() { var organizationType = await OrganizationTypeER.NewOrganizationTypeER(); organizationType.Name = "inserted name"; organizationType.CategoryOfOrganization = await CategoryOfOrganizationEC.GetCategoryOfOrganizationEC( new CategoryOfOrganization { Id = 1, Category = "Category name", DisplayOrder = 1 }); var savedOrganizationType = await organizationType.SaveAsync(); Assert.NotNull(savedOrganizationType); Assert.IsType <OrganizationTypeER>(savedOrganizationType); Assert.True(savedOrganizationType.Id > 0); }
public async Task OrganizationTypeER_NameExceedsMaxLengthOf50() { var organizationType = await OrganizationTypeER.NewOrganizationTypeER(); organizationType.Name = "valid name"; organizationType.CategoryOfOrganization = await CategoryOfOrganizationEC.NewCategoryOfOrganizationEC(); organizationType.CategoryOfOrganization.Category = "category name"; var isValidOrig = organizationType.IsValid; organizationType.Name = "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 "; Assert.NotNull(organizationType); Assert.True(isValidOrig); Assert.False(organizationType.IsValid); Assert.Equal("Name", organizationType.BrokenRulesCollection[0].Property); Assert.Equal("Name can not exceed 50 characters", organizationType.BrokenRulesCollection[0].Description); }