PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Rhino.Etl.Tests/UsingDAL/UsingDALFixture.cs

http://github.com/ayende/rhino-etl
C# | 53 lines | 44 code | 9 blank | 0 comment | 0 complexity | f3696e3382117daecbb869cedcc0732d MD5 | raw file
 1using System;
 2
 3namespace Rhino.Etl.Tests.UsingDAL
 4{
 5    using System.Collections.Generic;
 6    using System.IO;
 7    using Core;
 8    using Xunit;
 9
10    
11    public class UsingDALFixture
12    {
13        private const string expected =
14            @"Id	Name	Email
151	ayende	ayende@example.org
162	foo	foo@example.org
173	bar	bar@example.org
184	brak	brak@example.org
195	snar	snar@example.org
20";
21        [Fact]
22        public void CanWriteToFileFromDAL()
23        {
24            ExportUsersToFile export = new ExportUsersToFile();
25            export.Execute();
26            string actual = File.ReadAllText("users.txt");
27            Assert.Equal(expected.Replace("\r\n","\n").Replace("\n",Environment.NewLine), actual);
28        }
29
30        [Fact]
31        public void CanReadFromFileToDAL()
32        {
33            MySimpleDal.Users = new List<User>();
34            File.WriteAllText("users.txt", expected);
35
36            ImportUsersFromFile import = new ImportUsersFromFile();
37            import.Execute();
38
39            Assert.Equal(5, MySimpleDal.Users.Count);
40        }
41
42        [Fact]
43        public void CanReadFromFileToDALDynamic() {
44            MySimpleDal.Users = new List<User>();
45            File.WriteAllText("users.txt", expected);
46
47            var import = new ImportUsersFromFileDynamic();  
48            import.Execute();
49
50            Assert.Equal(5, MySimpleDal.Users.Count);
51        }
52    }
53}