public void Delete(AttachmentRule entity)
 {
     if (this.Values.Contains(entity))
     {
         this.Values.Remove(entity);
     }
 }
        public void Test_AttachmentRuleService_InsertOrUpdate()
        {
            var service = this.AttachmentRuleService;
            var rule = new AttachmentRule { Group = "test3" };

            service.InsertOrUpdate(rule);

            Assert.AreEqual(2, rule.Id, "Id");
            Assert.AreEqual("test3", rule.Group, "Group");
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AttachmentRuleDelete"/> class.
        /// </summary>
        /// <param name="rule">The rule.</param>
        public AttachmentRuleDelete(AttachmentRule rule)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            this.Id = rule.Id;
            this.Group = rule.Group;
            this.FileType = rule.FileType;
        }
        public void Test_AttachmentRuleService_Insert()
        {
            var rule = new AttachmentRule
            {
                Group = "test"
            };

            this.AttachmentRuleService.Insert(rule);

            Assert.AreEqual(2, rule.Id, "Id");
            Assert.AreEqual("test", rule.Group, "Group");
        }
        public void Test_AttachmentRuleCreateOrUpdate_ValueToModel()
        {
            var value = new AttachmentRuleCreateOrUpdate
            {
                Group = "test",
                FileType = "test2",
                FileExtension = "test3",
                FileSize = 2,
                FileWidth = 3,
                FileHeight = 4
            };

            var rule = new AttachmentRule();

            value.ValueToModel(rule);

            Assert.AreEqual("test", rule.Group, "Group");
            Assert.AreEqual("test2", rule.FileType, "FileType");
            Assert.AreEqual("test3", rule.FileExtension, "FileExtension");
            Assert.AreEqual(2, rule.FileSize, "FileSize");
            Assert.AreEqual(3, rule.FileWidth, "FileWidth");
            Assert.AreEqual(4, rule.FileHeight, "FileHeight");
        }
        public void Update(AttachmentRule entity)
        {
            if (this.Values.Contains(entity))
            {
                this.Values.Remove(entity);
            }

            this.Values.Add(entity);
        }
        public void Insert(AttachmentRule entity)
        {
            var id = this.Values.OrderByDescending(x => x.Id).Select(x => x.Id).First();

            entity.Id = id + 1;

            this.Values.Add(entity);
        }
 public void Update(AttachmentRule entity)
 {
 }
 public void InsertOrUpdate(AttachmentRule rule)
 {
 }
 public void Insert(AttachmentRule entity)
 {
 }
 public void Delete(AttachmentRule entity)
 {
 }