コード例 #1
0
        public async Task TestPhoneEC_NewPhoneEC()
        {
            var phone = await PhoneEC.NewPhoneEC();

            Assert.NotNull(phone);
            Assert.IsType <PhoneEC>(phone);
            Assert.False(phone.IsValid);
        }
コード例 #2
0
 private void BuildPhone(PhoneEC phone)
 {
     phone.PhoneType       = "mobile";
     phone.AreaCode        = "303";
     phone.Number          = "555-2368";
     phone.Extension       = "123";
     phone.DisplayOrder    = 1;
     phone.LastUpdatedBy   = "Hank";
     phone.LastUpdatedDate = DateTime.Now;
     phone.Notes           = "notes for phone";
 }
コード例 #3
0
        public async Task TestPhoneEC_LastUpdatedByRequired()
        {
            var phoneToTest = BuildPhone();
            var phone       = await PhoneEC.GetPhoneEC(phoneToTest);

            var isObjectValidInit = phone.IsValid;

            phone.LastUpdatedBy = string.Empty;

            Assert.NotNull(phone);
            Assert.True(isObjectValidInit);
            Assert.False(phone.IsValid);
            Assert.Equal("LastUpdatedBy", phone.BrokenRulesCollection[0].Property);
            Assert.Equal("LastUpdatedBy required", phone.BrokenRulesCollection[0].Description);
        }
コード例 #4
0
        public async Task TestPhoneEC_DescriptionLessThan50Chars()
        {
            var phoneToTest = BuildPhone();
            var phone       = await PhoneEC.GetPhoneEC(phoneToTest);

            var isObjectValidInit = phone.IsValid;

            phone.LastUpdatedBy = "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(phone);
            Assert.True(isObjectValidInit);
            Assert.False(phone.IsValid);
            Assert.Equal("LastUpdatedBy", phone.BrokenRulesCollection[0].Property);
            Assert.Equal("LastUpdatedBy can not exceed 255 characters", phone.BrokenRulesCollection[0].Description);
        }
コード例 #5
0
        public async Task TestPhoneEC_GetPhoneEC()
        {
            var phoneToLoad = BuildPhone();
            var phone       = await PhoneEC.GetPhoneEC(phoneToLoad);

            Assert.NotNull(phone);
            Assert.IsType <PhoneEC>(phone);
            Assert.Equal(phoneToLoad.Id, phone.Id);
            Assert.Equal(phoneToLoad.PhoneType, phone.PhoneType);
            Assert.Equal(phoneToLoad.AreaCode, phone.AreaCode);
            Assert.Equal(phoneToLoad.Number, phone.Number);
            Assert.Equal(phoneToLoad.Extension, phone.Extension);
            Assert.Equal(phoneToLoad.DisplayOrder, phone.DisplayOrder);
            Assert.Equal(phoneToLoad.LastUpdatedBy, phone.LastUpdatedBy);
            Assert.Equal(new SmartDate(phoneToLoad.LastUpdatedDate), phone.LastUpdatedDate);
            Assert.Equal(phoneToLoad.Notes, phone.Notes);
            Assert.Equal(phoneToLoad.RowVersion, phone.RowVersion);
            Assert.True(phone.IsValid);
        }