DataDrtTest.cs :  » 2.6.4-mono-.net-core » System.Windows » System » Windows » Controls » Test » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » 2.6.4 mono .net core » System.Windows 
System.Windows » System » Windows » Controls » Test » DataDrtTest.cs
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.Collections.Generic;

using System.Windows.Controls.Data.Test.DataClasses;
using System.Windows.Controls.Data.Test.DataClassSources;
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows.Controls.Data.Test;

namespace System.Windows.Controls.Test{
    #region DataGrid_P0
    /// <summary>
    /// This class runs the DRT checkin tests
    /// </summary>    
    [TestClass]
    public class DataDrtTest_P0 : SilverlightControlTest
    {
        private bool _loaded;
        private bool _preparedCell;

        /// <summary>
        /// P0 Test for the DataGrid
        /// </summary>
        [TestMethod]
        [Asynchronous]
        [Description("P0 test for the DataGrid")]
        public void DataGrid_P0()
        {
            List<Customer> boundList = CreateCustomerList(10);
            DataGrid dataGrid = new DataGrid();
            Assert.IsNotNull(dataGrid);
            dataGrid.Width = 350;
            dataGrid.Height = 250;
            dataGrid.Loaded += new RoutedEventHandler(DataGrid_P0_Loaded);
            dataGrid.ItemsSource = boundList;
            TestPanel.Children.Add(dataGrid);

            EnqueueConditional(delegate { return _loaded; });

            this.EnqueueYieldThread();
            EnqueueCallback(delegate
            {
                Assert.IsTrue(dataGrid.RowCount > 0);
                Assert.IsTrue(dataGrid.Columns.Count > 0);
                Assert.IsTrue(dataGrid.Columns[0].DesiredWidth > 0);
                Assert.IsTrue(dataGrid.Columns[0].ActualWidth > 0);
                Assert.IsNotNull(dataGrid.SelectedItem);
                Assert.IsTrue(dataGrid.SelectedIndex != -1);
                Assert.IsTrue(dataGrid.CellsWidth > 0);
                Assert.IsTrue(dataGrid.CellsHeight > 0);
                Assert.IsTrue(dataGrid.DisplayData.FirstDisplayedScrollingRow != -1);
                Assert.IsTrue(dataGrid.DisplayData.LastDisplayedScrollingRow != -1);
                Assert.IsTrue(dataGrid.DisplayData.FirstDisplayedScrollingCol != -1);
                dataGrid.PreparingCellForEdit += new EventHandler<DataGridPreparingCellForEditEventArgs>(DataGrid_P0_PreparingCellForEdit);
                dataGrid.BeginEdit();
            });

            EnqueueConditional(delegate { return _preparedCell; });

            this.EnqueueYieldThread();
            EnqueueCallback(delegate
            {
                dataGrid.CommitEdit(DataGridEditingUnit.Row, true);
            });

            EnqueueTestComplete();
        }

        private void DataGrid_P0_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
        {
            _preparedCell = true;
            TextBox textBox = e.EditingElement as TextBox;
            Assert.IsNotNull(textBox);
            Assert.IsTrue(!String.IsNullOrEmpty(textBox.Text), "Editing TextBox has no Text");
        }

        private void DataGrid_P0_Loaded(object sender, RoutedEventArgs e)
        {
            _loaded = true;
        }

        #region Helpers
        private List<Customer> CreateCustomerList(int size)
        {
            List<Customer> list = new List<Customer>();
            for (int i = 0; i < size; i++)
            {
                list.Add(new Customer());
            }
            return list;
        }
        #endregion
    }
    #endregion P0

    #region P1
        
    [TestClass]
    public partial class DataDrtTest_P1_DataTypesINPC_GenericList_5_RequireGT1 : DataGridUnitTest_RequireGT1<DataTypes, GenericList_5<DataTypes>>
    {
        public override void LoadRowDetailsUnloadRowDetails_VisibleAtLoadRow()
        {
        }

        public override void LoadRowUnloadRow()
        {
        }

        public override void RemoveItemsFromUnderlyingData()
        {
        }

        public override void ScrollIntoView()
        {
        }
    }
        
    [TestClass]
    public partial class DataDrtTest_P1_DataTypesINPC_GenericList_1_RequireGT0 : DataGridUnitTest_RequireGT0<DataTypes, GenericList_1<DataTypes>>
    {
    }
        
    [TestClass]
    public partial class DataDrtTest_P1_DataTypesINPC_GenericList_1_Unrestricted : DataGridUnitTest_Unrestricted<DataTypes, GenericList_1<DataTypes>>
    {
    }

    #endregion P1
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.