Exemplo n.º 1
0
        private async Task <PersonEC> BuildNewPersonEC()
        {
            var newPerson = await PersonEC.NewPersonEC();

            newPerson.Title = await TitleEC.GetTitleEC(new Title()
            {
                Id = 1
            });

            newPerson.LastName           = "Jones";
            newPerson.MiddleName         = String.Empty;
            newPerson.FirstName          = "Jack";
            newPerson.DateOfFirstContact = new SmartDate(DateTime.Now);
            newPerson.BirthDate          = new SmartDate(DateTime.Now);
            newPerson.LastUpdatedBy      = "markk";
            newPerson.LastUpdatedDate    = new SmartDate(DateTime.Now);
            newPerson.Code  = "new code";
            newPerson.Notes = "new notes";
            newPerson.EMail = await EMailEC.GetEMailEC(new EMail()
            {
                Id = 1
            });

            return(newPerson);
        }
        public async Task TestTitleEC_NewTitleEC()
        {
            var title = await TitleEC.NewTitleEC();

            Assert.NotNull(title);
            Assert.IsType <TitleEC>(title);
            Assert.False(title.IsValid);
        }
        public async Task TestTitleEC_GetTitleEC()
        {
            var titleToLoad = BuildTitle();
            var title       = await TitleEC.GetTitleEC(titleToLoad);

            Assert.NotNull(title);
            Assert.IsType <TitleEC>(title);
            Assert.Equal(titleToLoad.Id, title.Id);
            Assert.Equal(titleToLoad.Abbreviation, title.Abbreviation);
            Assert.Equal(titleToLoad.Description, title.Description);
            Assert.Equal(titleToLoad.DisplayOrder, title.DisplayOrder);
            Assert.Equal(titleToLoad.RowVersion, title.RowVersion);
            Assert.True(title.IsValid);
        }
        public async Task TestTitleEC_AbbreviationRequired()
        {
            var titleToTest = BuildTitle();
            var title       = await TitleEC.GetTitleEC(titleToTest);

            var isObjectValidInit = title.IsValid;

            title.Abbreviation = string.Empty;

            Assert.NotNull(title);
            Assert.True(isObjectValidInit);
            Assert.False(title.IsValid);
            Assert.Equal("Abbreviation", title.BrokenRulesCollection[0].Property);
            Assert.Equal("Abbreviation required", title.BrokenRulesCollection[0].Description);
        }
        public async Task TestTitleEC_DescriptionLessThan50Chars()
        {
            var titleToTest = BuildTitle();
            var title       = await TitleEC.GetTitleEC(titleToTest);

            var isObjectValidInit = title.IsValid;

            title.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 " +
                                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
                                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ";

            Assert.NotNull(title);
            Assert.True(isObjectValidInit);
            Assert.False(title.IsValid);
            Assert.Equal("Description", title.BrokenRulesCollection[0].Property);
        }
        private async Task BuildPersonEC(PersonEC personToBuild)
        {
            personToBuild.LastName           = "lastname";
            personToBuild.MiddleName         = "A";
            personToBuild.FirstName          = "Joe";
            personToBuild.DateOfFirstContact = DateTime.Now;
            personToBuild.BirthDate          = DateTime.Now;
            personToBuild.LastUpdatedDate    = DateTime.Now;
            personToBuild.LastUpdatedBy      = "edm";
            personToBuild.Code  = "code";
            personToBuild.Notes = "Notes";
            personToBuild.EMail = await EMailEC.GetEMailEC(new EMail()
            {
                Id = 1
            });

            personToBuild.Title = await TitleEC.GetTitleEC(new Title()
            {
                Id = 1
            });
        }
Exemplo n.º 7
0
 private void BuildTitle(TitleEC title)
 {
     title.Abbreviation = "abbr";
     title.Description  = "test description";
     title.DisplayOrder = 1;
 }
 private void BuildTitle(TitleEC titleToBuild)
 {
     titleToBuild.Abbreviation = "abbrev";
     titleToBuild.Description  = "description for title";
     titleToBuild.DisplayOrder = 1;
 }