Ejemplo n.º 1
0
        public void QueryEnum(IEnumerable <Size> sizes)
        {
            // Arrange
            var expected = sizes;

            var serializable = sizes.Select(v => new TestData.SingleValueRow
            {
                Value = ((int)v).ToString()
            }).ToList();

            var xml = Serialize(serializable);

            var service = new MockTransactionService(xml);

            // Act
            var actual = service.QueryReader2 <Size>("").ToList();

            // Assert
            actual.Should().BeEquivalentTo(expected);
        }
Ejemplo n.º 2
0
        public void QueryNullableInt()
        {
            // Arrange
            var data     = GenerateData(3);
            var expected = data.Select(d => (int?)d.Age);

            var serializable = data.Select(t => new TestData.Timekeeper
            {
                Age = t.Age
            }).ToList();

            var xml = Serialize(serializable);

            var service = new MockTransactionService(xml);

            // Act
            var actual = service.QueryReader2 <int?>("").ToList();

            // Assert
            actual.Should().BeEquivalentTo(expected);
        }
Ejemplo n.º 3
0
        public void QueryNullableDateTime()
        {
            // Arrange
            var data     = GenerateData(3);
            var expected = data.Select(d => d.DateOfBirth);

            var serializable = data.Select(t => new TestData.SingleValueRow
            {
                Value = t.DateOfBirth?.ToString("yyyy-MM-dd") ?? ""
            }).ToList();

            var xml = Serialize(serializable);

            var service = new MockTransactionService(xml);

            // Act
            var actual = service.QueryReader2 <DateTime?>("").ToList();

            // Assert
            actual.Should().BeEquivalentTo(expected);
        }
Ejemplo n.º 4
0
        public void Constructor3()
        {
            // Arrange
            var data         = GenerateData(3);
            var serializable = data.Select(t => new TestData.Timekeeper
            {
                Name         = t.Name,
                Age          = t.Age,
                DateOfBirth  = t.DateOfBirth?.ToString("yyyy-MM-dd") ?? "",
                MatterNumber = t.MatterNumber?.ToString() ?? ""
            }).ToList();

            var xml = Serialize(serializable);

            var service = new MockTransactionService(xml);

            // Act
            var actual = service.QueryReader2 <TimekeeperCtor>("").ToList();

            // Assert
            actual.Should().BeEquivalentTo(data);
        }
Ejemplo n.º 5
0
        public void Properties2()
        {
            // Arrange
            var data     = GenerateData(3);
            var expected = data.Select(d => new TimekeeperSimpleProp {
                Name = d.Name, Age = d.Age
            });

            var serializable = data.Select(t => new TestData.Timekeeper
            {
                Name = t.Name,
                Age  = t.Age
            }).ToList();

            var xml = Serialize(serializable);

            var service = new MockTransactionService(xml);

            // Act
            var actual = service.QueryReader2 <TimekeeperSimpleProp>("").ToList();

            // Assert
            actual.Should().BeEquivalentTo(expected);
        }