Skip to content

Extends Verify to allow verification of documents via DocNet.

License

Notifications You must be signed in to change notification settings

VerifyTests/Verify.Sep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.Sep

Discussions Build status NuGet Status

Extends Verify to allow verification of CSVs via Sep.

See Milestones for release notes.

Sponsors

Entity Framework Extensions

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Entity Framework Extensions

NuGet

Usage

Enable Verify.Sep

[ModuleInitializer]
public static void Initialize() =>
    VerifySep.Initialize();

snippet source | anchor

Sample input

Index,Customer Id,First Name,Last Name,Company,City,Country,Phone,Dob
1,44e0f9d9-e56e-4626-b88f-b29fecb8c584,Sheryl,Baxter,Rasmussen Group,East Leonard,Chile,229.077.5154,1/02/2025
2,e58dd853-3aa0-4360-9dd1-86be558a1ad8,Preston,Lozano,Vega-Gentry,East Jimmychester,Djibouti,5153435776,2/02/2025
3,0de1d6ab-f7ad-455c-822e-fbe6e9b7e40a,Roy,Berry,Murillo-Perry,Isabelborough,Antigua and Barbuda,-1199,3/02/2025
4,c26c7ead-2f50-44a4-bba6-2dde0228f280,Linda,Olsen,Mcmillan and Donovan,Bensonview,Dominican Republic,001-808-617-6467,4/02/2025
5,e5f7febf-bedf-4f77-924d-472f30897928,Joanna,Bender,Lang and Andrade,West Priscilla,Slovakia,001-234-203-0635,5/02/2025
6,355a51db-8b9d-4210-bf50-b4a733080985,Aimee,Downs,Steele Group,Chavezborough,Bosnia and Herzegovina,(283)437-3886,6/02/2025
7,b9d9dc41-9fc3-49d8-a418-36229ceeba0f,Darren,Peck,Woodard and Mitchell,Lake Ana,Pitcairn Islands,(496)452-6181,7/02/2025
8,f7b4f884-0d6a-4ddb-b3ac-4235b06bf390,Brett,Mullen,Davenport and Giles,Kimport,Bulgaria,001-583-352-7197,8/02/2025
9,e2aafdb2-fb28-433a-96ad-cacac4f0daf4,Sheryl,Meyers,Browning-Simon,Robersonstad,Cyprus,854-138-4911,9/02/2025

snippet source | anchor

Verify a file

[Test]
public Task VerifyCsv() =>
    VerifyFile("sample.csv");

snippet source | anchor

Results in:

Index,Customer Id,First Name,Last Name,Company,City,Country,Phone,Dob
1,Guid_1,Sheryl,Baxter,Rasmussen Group,East Leonard,Chile,229.077.5154,Date_1
2,Guid_2,Preston,Lozano,Vega-Gentry,East Jimmychester,Djibouti,5153435776,Date_2
3,Guid_3,Roy,Berry,Murillo-Perry,Isabelborough,Antigua and Barbuda,-1199,Date_3
4,Guid_4,Linda,Olsen,Mcmillan and Donovan,Bensonview,Dominican Republic,001-808-617-6467,Date_4
5,Guid_5,Joanna,Bender,Lang and Andrade,West Priscilla,Slovakia,001-234-203-0635,Date_5
6,Guid_6,Aimee,Downs,Steele Group,Chavezborough,Bosnia and Herzegovina,(283)437-3886,Date_6
7,Guid_7,Darren,Peck,Woodard and Mitchell,Lake Ana,Pitcairn Islands,(496)452-6181,Date_7
8,Guid_8,Brett,Mullen,Davenport and Giles,Kimport,Bulgaria,001-583-352-7197,Date_8
9,Guid_9,Sheryl,Meyers,Browning-Simon,Robersonstad,Cyprus,854-138-4911,Date_9

snippet source | anchor

Note that Guid and date scrubbing is respected.

Verify a Stream

[Test]
public Task VerifyCsvStream()
{
    var stream = File.OpenRead("sample.csv");
    return Verify(stream, "csv");
}

snippet source | anchor

IgnoreColumns

Excludes the column from the output.

[Test]
public Task IgnoreColumns() =>
    VerifyFile("sample.csv")
        .IgnoreCsvColumns("Customer Id");

snippet source | anchor

Results in:

Index,First Name,Last Name,Company,City,Country,Phone,Dob
1,Sheryl,Baxter,Rasmussen Group,East Leonard,Chile,229.077.5154,Date_1
2,Preston,Lozano,Vega-Gentry,East Jimmychester,Djibouti,5153435776,Date_2
3,Roy,Berry,Murillo-Perry,Isabelborough,Antigua and Barbuda,-1199,Date_3
4,Linda,Olsen,Mcmillan and Donovan,Bensonview,Dominican Republic,001-808-617-6467,Date_4
5,Joanna,Bender,Lang and Andrade,West Priscilla,Slovakia,001-234-203-0635,Date_5
6,Aimee,Downs,Steele Group,Chavezborough,Bosnia and Herzegovina,(283)437-3886,Date_6
7,Darren,Peck,Woodard and Mitchell,Lake Ana,Pitcairn Islands,(496)452-6181,Date_7
8,Brett,Mullen,Davenport and Giles,Kimport,Bulgaria,001-583-352-7197,Date_8
9,Sheryl,Meyers,Browning-Simon,Robersonstad,Cyprus,854-138-4911,Date_9

snippet source | anchor

ScrubColumns

Replaces the column with {Scrubbed}.

[Test]
public Task ScrubCsvColumns() =>
    VerifyFile("sample.csv")
        .ScrubCsvColumns("Customer Id");

snippet source | anchor

Results in:

Index,Customer Id,First Name,Last Name,Company,City,Country,Phone,Dob
1,{Scrubbed},Sheryl,Baxter,Rasmussen Group,East Leonard,Chile,229.077.5154,Date_1
2,{Scrubbed},Preston,Lozano,Vega-Gentry,East Jimmychester,Djibouti,5153435776,Date_2
3,{Scrubbed},Roy,Berry,Murillo-Perry,Isabelborough,Antigua and Barbuda,-1199,Date_3
4,{Scrubbed},Linda,Olsen,Mcmillan and Donovan,Bensonview,Dominican Republic,001-808-617-6467,Date_4
5,{Scrubbed},Joanna,Bender,Lang and Andrade,West Priscilla,Slovakia,001-234-203-0635,Date_5
6,{Scrubbed},Aimee,Downs,Steele Group,Chavezborough,Bosnia and Herzegovina,(283)437-3886,Date_6
7,{Scrubbed},Darren,Peck,Woodard and Mitchell,Lake Ana,Pitcairn Islands,(496)452-6181,Date_7
8,{Scrubbed},Brett,Mullen,Davenport and Giles,Kimport,Bulgaria,001-583-352-7197,Date_8
9,{Scrubbed},Sheryl,Meyers,Browning-Simon,Robersonstad,Cyprus,854-138-4911,Date_9

snippet source | anchor

Verify a SepReader

[Test]
public Task VerifyReader()
{
    using var reader = Sep.Reader().FromFile("sample.csv");
    return Verify(reader);
}

snippet source | anchor

Icon

Csv designed by iconade from The Noun Project.

About

Extends Verify to allow verification of documents via DocNet.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Contributors 2

  •  
  •  

Languages