示例#1
0
        public void AddImageFromFile_Do_Not_Add_Duplicate()
        {
            var target = new ProjectContainer();
            int count  = 0;

            target.PropertyChanged += (sender, e) =>
            {
                count++;
            };

            var key  = ProjectContainer.ImageEntryNamePrefix + "image.jpg";
            var key1 = target.AddImageFromFile(@"C:/Images/image.jpg", new byte[] { });
            var key2 = target.AddImageFromFile(@"C:/Images/image.jpg", new byte[] { });

            Assert.Equal(key, key1);
            Assert.Equal(key, key2);
            Assert.Contains(target.Keys, item => item.Key == key);
            Assert.Equal(1, count);
        }
示例#2
0
        public void AddImageFromFile_Add_Key_And_Notify()
        {
            var    target = new ProjectContainer();
            string actual = null;

            target.PropertyChanged += (sender, e) =>
            {
                actual = e.PropertyName;
            };

            var key = target.AddImageFromFile(@"C:/Images/image.jpg", new byte[] { });

            Assert.Equal(ProjectContainer.ImageEntryNamePrefix + "image.jpg", key);
            Assert.Contains(target.Keys, item => item.Key == key);
            Assert.Equal("Keys", actual);
        }