示例#1
0
        public ISocket4 Accept()
        {
            CountingSocket4 accepted = new CountingSocket4(new NullSocket());

            _acceptedSockets.Add(accepted);
            return(accepted);
        }
示例#2
0
        private void AssertCounter(Action <ISocket4> operation, Func <CountingSocket4, double> expectedValueRetriever, Func <IObjectContainer, double> actualValueRetriever)
        {
            ObjectContainerBase container = (ObjectContainerBase)Db();

            container.WithEnvironment(delegate
            {
                CountingSocket4 countingSocket = new CountingSocket4(new NullSocket());
                ISocket4 socket = new MonitoredClientSocket4(countingSocket);

                operation(socket);

                Assert.AreEqual(ByteCount, expectedValueRetriever(countingSocket));
                Assert.AreEqual(ByteCount, actualValueRetriever(container));
            });
        }