I would write an interface that abstracts away the hard to test parts of the named pipe.
The implementation of this would be fairly straightforward (using the NamedPipe... apis) and I wouldn't unit test that.
Once thats done I use the interface in the application code. I'd have a mock implementation in the test code and I would use the mock object to do stuff on the pipe.
E.g. my interface would have a ClientConnected event exposing some data about the client.
I'd then implement this interface in a mock object and have it raise the client connected event and assert that the application did the correct things when the client was connected.
HTH.