public void ShouldNotSerializeExpressionColumn()
            {
                var isRunningOnMono = Type.GetType("Mono.Runtime") != null;

                if (!isRunningOnMono)
                {
                    // Arrange
                    var columnName = "foo";
                    var dataTable  = new DataTable();

                    dataTable.Columns.Add(columnName, typeof(int));

                    dataTable.Rows.Add(1);

                    var dataReader = dataTable.CreateDataReader();

                    dataReader.GetSchemaTable().Rows[0]["Expression"] = true;

                    var options = new ProtoDataWriterOptions()
                    {
                        IncludeComputedColumns = false
                    };

                    // Act
                    var reader = new ProtoReader(this.Serialize(dataReader, options), null, null);

                    // Assert
                    var readerContext = new ProtoReaderContext(reader);

                    readerContext.ReadExpectedFieldHeader(ResultFieldHeader);
                    readerContext.StartSubItem();

                    Assert.Equal(RecordFieldHeader, reader.ReadFieldHeader());
                }
            }
Exemple #2
0
            public void ShouldSerializeEmptyCharArrayAsNull()
            {
                // Arrange
                var dataReader = this.CreateDataReader(new char[0]);
                var options    = new ProtoDataWriterOptions()
                {
                    SerializeEmptyArraysAsNull = true
                };

                // Act
                var reader = new ProtoReader(this.Serialize(dataReader, options), null, null);

                // Assert
                var readerContext = new ProtoReaderContext(reader);

                readerContext.ReadUntilField();

                readerContext.ReadExpectedFieldHeader(3);
                readerContext.StartSubItem();

                Assert.Equal(0, reader.ReadFieldHeader());
            }