예제 #1
0
		public void ReadFileContents_SettledDataIsRequested_ReturnNull()
		{
			// Arrange
			var stubFileReader = MockRepository.GenerateStub<IFileReader>();
			stubFileReader.Stub(x => x.ReadFlatFile("")).IgnoreArguments().Return(null);

			// Act
			var sut = new FileAccessProvider(stubFileReader);
			var result = sut.ReadFileContents("");

			// Assert
			Assert.IsNull(result);
		}
예제 #2
0
		public void ReadFileContents_SettledDataIsRequested_ReturnData()
		{
			// Arrange
			var stubData = new[]
				{
					"Customer,Event,Participant,Stake,Win"
					, "1,11,4,50,500"
					, "3,11,6,50,400"
					, "4,11,7,300,1200"
					, "5,11,2,20,80"
					, "1,12,4,500,5000"
				};

			var stubFileReader = MockRepository.GenerateStub<IFileReader>();
			stubFileReader.Stub(x => x.ReadFlatFile("")).IgnoreArguments().Return(stubData);

			// Act
			var sut = new FileAccessProvider(stubFileReader);
			var result = sut.ReadFileContents("");

			// Assert
			Assert.AreEqual(5, result.Length);
		}