コード例 #1
0
        public void CSVReaderWriter_Write_NullWriterOpen()
        {
            var csvReaderWriter = new CSVReaderWriter(null, null, delimiter);

            Assert.Throws <ApplicationException>(() => csvReaderWriter.Open("somedata", Mode.Write));
            Assert.Throws <ApplicationException>(() => csvReaderWriter.OpenWrite("somedata"));
        }
コード例 #2
0
        public void CSVReaderWriter_Read_NotOpenedOnWriteOpen()
        {
            MockDataReader mockReader = new MockDataReader();
            MockDataWriter mockWriter = new MockDataWriter();

            mockReader.OpenDelegate =
                (s) =>
            {
                Assert.Fail("Open called for reader");
            };

            var csvReaderWriter = new CSVReaderWriter(mockReader, mockWriter, delimiter);

            csvReaderWriter.Open("somefilepath", Mode.Write);
            csvReaderWriter.OpenWrite("somefilepath");
        }
コード例 #3
0
        public void CSVReaderWriter_Write_Opened()
        {
            int            openCalled = 0;
            MockDataWriter mockWriter = new MockDataWriter();

            mockWriter.OpenDelegate =
                (s) =>
            {
                Assert.AreEqual("somefilepath", s);
                openCalled++;
            };

            var csvReaderWriter = new CSVReaderWriter(null, mockWriter, delimiter);

            csvReaderWriter.Open("somefilepath", Mode.Write);
            csvReaderWriter.OpenWrite("somefilepath");
            Assert.AreEqual(2, openCalled);
        }