コード例 #1
0
        public void ChecksNameUniqueness()
        {
            var dashboard = new GroupDashboard();

            dashboard.Add();
            dashboard.Add();

            var group1 = dashboard.Properties[0];
            var group2 = dashboard.Properties[1];

            group1.PropertyName = "a";
            group2.PropertyName = "b";

            Assert.True(dashboard.CanChangeName(group1, "a"));
            Assert.False(dashboard.CanChangeName(group1, "b"));
        }
コード例 #2
0
        public void LooksUpGroupByName()
        {
            var dashboard = new GroupDashboard();

            dashboard.Add();
            dashboard.Add();

            var group1 = dashboard.Properties[0];
            var group2 = dashboard.Properties[1];

            group1.PropertyName = "a";
            group2.PropertyName = "b";

            Assert.Equal(group1, dashboard.GetByName(group1.PropertyName));
            Assert.Equal(group2, dashboard.GetByName(group2.PropertyName));
        }
コード例 #3
0
        public void GroupDashboardFiresUpdateEvents()
        {
            var flag = new AutoResetEvent(false);

            var groupDashboard = new GroupDashboard();

            groupDashboard.PropertyChanged += (sender, args) => flag.Set();

            groupDashboard.Add();

            if (!flag.WaitOne(1000))
            {
                Assert.True(false, "Event not fired");
            }

            groupDashboard.Remove(groupDashboard.Properties[0]);

            if (!flag.WaitOne(1000))
            {
                Assert.True(false, "Event not fired");
            }
        }