Пример #1
0
        public void AssertRow <T>(T expectedItem, params string[] propertiesNotToCompare)
            where T : new()
        {
            var actualItem = GetItem <T>();

            EntitiesAsserter.AreEqual(expectedItem, actualItem, propertiesNotToCompare);
        }
Пример #2
0
        public void AssertRow <T>(T expectedItem)
            where T : new()
        {
            var actualItem = GetItem <T>();

            EntitiesAsserter.AreEqual(expectedItem, actualItem);
        }
Пример #3
0
        public void AssertTable <TRowObject>(List <TRowObject> expectedEntities, params string[] propertiesNotToCompare)
            where TRowObject : new()
        {
            ScrollToVisible();
            Assert.AreEqual(expectedEntities.Count, RowsCount, $"Expected rows count {expectedEntities.Count} but rows was {RowsCount}");

            for (int i = 0; i < RowsCount; i++)
            {
                var entity = CastRow <TRowObject>(i, propertiesNotToCompare);
                EntitiesAsserter.AreEqual(expectedEntities[i], entity, propertiesNotToCompare);
            }
        }
Пример #4
0
        protected void AssertTable <T, TRow>(List <TRow> rows, List <T> expectedEntities)
            where T : new()
            where TRow : TableRow
        {
            var actualEntities = GetItems <T, TRow>(rows);

            if (actualEntities.Count != expectedEntities.Count)
            {
                throw new ArgumentException($"The current table rows count {actualEntities.Count} is different than the specified expected values {expectedEntities.Count}.");
            }

            for (int i = 0; i < expectedEntities.Count; i++)
            {
                EntitiesAsserter.AreEqual(expectedEntities[i], actualEntities[i]);
            }
        }
Пример #5
0
        public void AssertObjectsData()
        {
            // You can get all rows as instances of a specific class through the GetItems method.
            var expectedObj = _expectedItems[0];
            var actualObj   = TestGrid.GetItems <Employee>()[0];

            EntitiesAsserter.AreEqual(expectedObj, actualObj);

            // Instead of first casting the items and then to get them by index and then assert them manually.
            // You can get specific row through GetRow method and use the built-in AssertRow method to verify the row's data.
            TestGrid.GetRow(0).AssertRow(expectedObj);

            // Compares all grid rows to the expected entities. Each row is internally converted to the type of the expected entities.
            TestGrid.AssertTable(_expectedItems);

            // You can get all header names. Doubled headers are returned as one entry and separated by space.
            Assert.AreEqual("Email Personal", TestGrid.GetHeaderNames().FirstOrDefault(header => header.StartsWith("Email")));
        }