Exemple #1
0
        public async Task TestAddressEC_PostCodeRequired()
        {
            var addressToTest = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToTest);

            var isObjectValidInit = address.IsValid;

            address.PostCode = string.Empty;

            Assert.NotNull(address);
            Assert.True(isObjectValidInit);
            Assert.False(address.IsValid);
            Assert.Equal("PostCode", address.BrokenRulesCollection[0].Property);
            Assert.Equal("PostCode required", address.BrokenRulesCollection[0].Description);
        }
Exemple #2
0
        public async Task TestAddressEC_PostCodeExceedsMaxLengthOf9()
        {
            var addressToTest = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToTest);

            var isObjectValidInit = address.IsValid;

            address.PostCode = "Lorem ipsum dolor sit amet";

            Assert.NotNull(address);
            Assert.True(isObjectValidInit);
            Assert.False(address.IsValid);
            Assert.Equal("PostCode", address.BrokenRulesCollection[0].Property);
            Assert.Equal("PostCode can not exceed 9 characters", address.BrokenRulesCollection[0].Description);
        }
Exemple #3
0
        public async Task TestAddressEC_StateExceedsMaxLengthOf2()
        {
            var addressToTest = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToTest);

            var isObjectValidInit = address.IsValid;

            address.State = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ";

            Assert.NotNull(address);
            Assert.True(isObjectValidInit);
            Assert.False(address.IsValid);
            Assert.Equal("State", address.BrokenRulesCollection[0].Property);
            Assert.Equal("State can not exceed 2 characters", address.BrokenRulesCollection[0].Description);
        }
Exemple #4
0
        public async Task TestAddressEC_LastUpdatedDateRequired()
        {
            var addressToTest = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToTest);

            var isObjectValidInit = address.IsValid;

            address.LastUpdatedDate = DateTime.MinValue;

            Assert.NotNull(address);
            Assert.True(isObjectValidInit);
            Assert.False(address.IsValid);
            Assert.Equal("LastUpdatedDate", address.BrokenRulesCollection[0].Property);
            Assert.Equal("LastUpdatedDate required", address.BrokenRulesCollection[0].Description);
        }
Exemple #5
0
        public async Task TestAddressEC_LastUpdatedByExceedsMaxLengthOf255()
        {
            var addressToTest = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToTest);

            var isObjectValidInit = address.IsValid;

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

            Assert.NotNull(address);
            Assert.True(isObjectValidInit);
            Assert.False(address.IsValid);
            Assert.Equal("LastUpdatedBy", address.BrokenRulesCollection[0].Property);
            Assert.Equal("LastUpdatedBy can not exceed 255 characters", address.BrokenRulesCollection[0].Description);
        }
Exemple #6
0
        public async Task TestAddressEC_GetNewAddressEC()
        {
            var addressToLoad = BuildAddress();
            var address       = await AddressEC.GetAddressEC(addressToLoad);

            Assert.NotNull(address);
            Assert.IsType <AddressEC>(address);
            Assert.Equal(addressToLoad.Id, address.Id);
            Assert.Equal(addressToLoad.Address1, address.Address1);
            Assert.Equal(addressToLoad.Address2, address.Address2);
            Assert.Equal(addressToLoad.City, address.City);
            Assert.Equal(addressToLoad.State, address.State);
            Assert.Equal(addressToLoad.PostCode, address.PostCode);
            Assert.Equal(addressToLoad.Notes, address.Notes);
            Assert.Equal(addressToLoad.LastUpdatedBy, address.LastUpdatedBy);
            Assert.Equal(new SmartDate(addressToLoad.LastUpdatedDate), address.LastUpdatedDate);
            Assert.True(address.IsValid);
        }