Exemple #1
0
        public async Task OrganizationER_New()
        {
            var organization = await OrganizationER.NewOrganizationER();

            Assert.NotNull(organization);
            Assert.False(organization.IsValid);
        }
Exemple #2
0
        public async Task OrganizationER_TestInvalidSave()
        {
            var organization = await OrganizationER.NewOrganizationER();

            organization.Name = String.Empty;

            Assert.False(organization.IsValid);
            await Assert.ThrowsAsync <ValidationException>(() => organization.SaveAsync());
        }
Exemple #3
0
        public async void OrganizationER_Insert()
        {
            var organization = await OrganizationER.NewOrganizationER();

            await BuildValidOrganization(organization);

            var savedOrganization = await organization.SaveAsync();

            Assert.NotNull(savedOrganization);
            Assert.IsType <OrganizationER>(savedOrganization);
            Assert.True(savedOrganization.Id > 0);
            Assert.NotNull(savedOrganization.RowVersion);
        }
Exemple #4
0
        public async Task OrganizationER_NameCanNotExceed50Characters()
        {
            var organization = await OrganizationER.NewOrganizationER();

            await BuildValidOrganization(organization);

            organization.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 " +
                                "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " +
                                "Duis aute irure dolor in reprehenderit";

            Assert.NotNull(organization);
            Assert.False(organization.IsValid);
            Assert.Equal("Name", organization.BrokenRulesCollection[0].Property);
            Assert.Equal("Name can not exceed 50 characters", organization.BrokenRulesCollection[0].Description);
        }
Exemple #5
0
        public async Task OrganizationER_NameRequired()
        {
            var organization = await OrganizationER.NewOrganizationER();

            await BuildValidOrganization(organization);

            var isObjectValidInit = organization.IsValid;

            organization.Name = string.Empty;

            Assert.NotNull(organization);
            Assert.True(isObjectValidInit);
            Assert.False(organization.IsValid);
            Assert.Equal("Name", organization.BrokenRulesCollection[0].Property);
            Assert.Equal("Name required", organization.BrokenRulesCollection[0].Description);
        }