Skip to main content
100%

CsvFieldsSaver + Tests

✓ Published0🌍 Public
RRestuta
Last edited Sep 22, 2010
Created on Sep 22, 2010

This example demonstrates a C# class, CsvFieldsSaver, that formats form data into CSV output through a TextWriter, handling edge cases like commas, double quotes, leading/trailing spaces, and embedded line breaks by enclosing values per CSV standards. It uses NUnit for testing and Rhino Mocks to mock writers, with a FileWriter wrapping a StreamWriter around a MemoryStream to verify the resulting CSV strings. The code shows how to quote embedded double quotes by doubling them, and focuses on unit-testing the serialization logic.

AI-generated description

Similar vizzes