Esempio n. 1
0
        public void OrderQueryByNameDesc_Test()
        {
            // Arrange
            List <SqlQuery> unorderedQueries = new List <SqlQuery>()
            {
                new SqlQuery()
                {
                    SqlQueryId          = 1,
                    SqlQueryName        = "QueryNameA",
                    SqlQueryContent     = "QueryContentA",
                    SqlQueryCreatedDate = DateTime.Today.AddDays(-1)
                },
                new SqlQuery()
                {
                    SqlQueryId          = 0,
                    SqlQueryName        = "QueryNameB",
                    SqlQueryContent     = "QueryContentB",
                    SqlQueryCreatedDate = DateTime.Today
                }
            };

            // Act
            IEnumerable <SqlQuery> orderedQueries = queryRepo.OrderQueryByNameDesc(unorderedQueries);

            // Assert
            Assert.AreNotEqual(
                unorderedQueries.First().SqlQueryName,
                orderedQueries.First().SqlQueryName
                );
            Assert.AreNotEqual(
                unorderedQueries.Last().SqlQueryName,
                orderedQueries.Last().SqlQueryName
                );

            Assert.AreEqual(
                unorderedQueries.Count(),
                orderedQueries.Count()
                );
        }