Ejemplo n.º 1
0
        public void TypeExtensions_GetHeaders_Comparer_Test()
        {
            // Arrange
            var expected = new[] { "Id", "Name", "A", "B", "C" };
            var comparer = new HeaderPriorityComparer();

            // Act
            var actual = typeof(UnorderedPropertyObject).GetHeaders(comparer);

            // Assert
            CollectionAssert.AreEqual(expected, actual.ToArray());
        }
Ejemplo n.º 2
0
        public void EnumerableExtensions_Comparer_Tests()
        {
            // Arrange
            var items = new[] {
                new UnorderedPropertyObject {
                    Id = 10, Name = "Awesome Name", A = 10, B = 5, C = 7
                },
                new UnorderedPropertyObject {
                    Id = 11, Name = "Awesome Name, Inc", A = 11, B = 7, C = 3
                },
            };
            var expected = "Id,Name,A,B,C\r\n10,Awesome Name,10,5,7\r\n11,\"Awesome Name, Inc\",11,7,3";
            var comparer = new HeaderPriorityComparer();

            // Act
            var actual = items.ToCsv(comparer: comparer);

            // Assert
            Assert.AreEqual(expected, actual);
        }