• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualfrob

Posted 07 September 2013 - 12:21 AM

After reading that a few times, it looks like you have a unit test for the buffers, and an acceptance test / integration test for the archiving system as a whole.

For the buffering system, I would think this kind of test would work for the problem you described:
[TestFixture]
public class BufferedOutputStreamShould {
[Test]
public void StoreMaxBytesWithoutFlushing() {...}
[Test]
public void StoreMaxPlusOneBytesWithFlushing_AndLeaveOneByteBuffered() {...}
[Test]
}

These things could be testable by exposing the maximum number of bytes that can be buffered and the bytes still in the buffer. Neither requires great insights into the details, and you can modify the actual number of bytes later without changing the interface. Simple functions like GetBufferTotalSize() and GetBufferRemaining() should suffice, no need for friends.

This should address your concerns about it dumping the data before it is completely full, and verify that buffering is dumping the data when it becomes exactly full.

The archiving system as a whole can operate without regard to buffering. Here's the things I would expect in the integration tests:

[TestFixture]
public class ArchivingSystemShould  {
[Test]
[Test]
[Test]
}


: The editor ate my formatting...

### #1frob

Posted 07 September 2013 - 12:13 AM

After reading that a few times, it looks like you have a unit test for the buffers, and an acceptance test / integration test for the archiving system as a whole.

For the buffering system, I would think this kind of test would work for the problem you described:
[TestFixture]
public class BufferedOutputStreamShould {
[Test]  public void StoreMaxBytesWithoutFlushing() {...}
[Test]  public void StoreMaxPlusOneBytesWithFlushing_AndStillHaveOneByteBuffered() {...}
}

These things could be testable by exposing the maximum number of bytes that can be buffered and the bytes still in the buffer. Neither requires great insights into the details, and you can modify the actual number of bytes later without changing the interface. Simple functions like GetBufferTotalSize() and GetBufferRemaining() should suffice, no need for friends.

This should address your concerns about it dumping the data before it is completely full, and verify that buffering is dumping the data when it becomes exactly full.

The archiving system as a whole can operate without regard to buffering. Here's the things I would expect in the integration tests:

[TestFixture]
public class ArchivingSystemShould  {