public static Filter FilterNew()
        {
            var filter = FilterRepository.FilterNew();

            filter.Name         = DataHelper.RandomString(50);
            filter.FilterQuery  = DataHelper.RandomString(1000);
            filter.SourceTypeId = (int)SourceType.User;

            return(filter);
        }
Esempio n. 2
0
        public void Filter_Create()
        {
            var filter = FilterRepository.FilterNew();

            Assert.IsTrue(filter.IsNew, "IsNew should be true");
            Assert.IsTrue(filter.IsDirty, "IsDirty should be true");
            Assert.IsFalse(filter.IsValid, "IsValid should be false");
            Assert.IsTrue(filter.IsSelfDirty, "IsSelfDirty should be true");
            Assert.IsFalse(filter.IsSelfValid, "IsSelfValid should be false");

            Assert.IsTrue(
                ValidationHelper.ContainsRule(filter, DbType.String, "Name"),
               "Name should be required");

            Assert.IsTrue(
                ValidationHelper.ContainsRule(filter, DbType.String, "FilterQuery"),
               "FilterQuery should be required");

            Assert.IsTrue(
                ValidationHelper.ContainsRule(filter, DbType.Int32, "SourceTypeId"),
               "SourceTypeId should be required");
        }