/// <summary> /// Initializes a new instance of the <see cref="NetworkSession"/> class. /// </summary> public NetworkSession() { this.isActive = false; this.receiveDescriptor = new ReceiveDescriptor(this); this.sendDescriptor = new SendDescriptor(this); }
public void FlipIf_Should_Return_True_When_Flip_Is_Successful() { var b = new AtomicBoolean(true); var flipped = b.FlipIf(true); flipped.Should().BeTrue(); }
/// <summary> /// Initializes a new instance of the <see cref="SendDescriptor"/> class. /// </summary> /// <param name="container">The <see cref="IDescriptorContainer"/> containing this instance.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="container" /> is <see langword="null"/>. /// </exception> public SendDescriptor(IDescriptorContainer container) : base(container) { this.SocketArgs.Completed += this.EndSendAsynchronous; this.isSending = new AtomicBoolean(false); this.queue = new ConcurrentQueue<byte[]>(); }
/// <summary> /// Initializes a new instance of the <see cref="ServerSession"/> class. /// </summary> public ServerSession(IPacketCodeTable packetCodeTable) { this.NetworkSessionId = RollingNetworkSessionId.Increment(); this.isPushing = false; this.packets = new ConcurrentQueue<byte[]>(); this.packetCodeTable = packetCodeTable; this.PacketReceived += this.HandlePacketReceived; }
/// <summary> /// Initializes a new instance of the <see cref="ServerProcess"/> class. /// </summary> public ServerProcess( IServerSessionFactory sessionFactory, ISocketAcceptorFactory socketAcceptorFactory, IPacketScheduler packetScheduler, IRollingIvFactoryProvider rollingIvFactoryProvider, IvGenerator ivGenerator, ILogger logger) { this.sessionFactory = sessionFactory; this.socketAcceptorFactory = socketAcceptorFactory; this.packetScheduler = packetScheduler; this.rollingIvFactoryProvider = rollingIvFactoryProvider; this.ivGenerator = ivGenerator; this.logger = logger; this.isConfigured = false; this.isDisposed = false; this.isRunning = new AtomicBoolean(false); }
public void FlipIf_Should_Set_New_Value_When_Comparand_Matches() { var b = new AtomicBoolean(true); b.FlipIf(true); b.Value.Should().BeFalse(); }
public void Explicit_Cast_Should_Cast_To_True() { var b = new AtomicBoolean(true); var cast = (bool)b; cast.Should().BeTrue(); }
public void Explicit_Cast_Should_Cast_To_False() { var b = new AtomicBoolean(false); var cast = (bool)b; cast.Should().BeFalse(); }
public void Constructor_Should_Set_Value_To_True() { var b = new AtomicBoolean(true); b.Value.Should().BeTrue(); }
public void Constructor_Should_Set_Value_To_False() { var b = new AtomicBoolean(false); b.Value.Should().BeFalse(); }
public void ToBoolean_Should_Return_True() { var b = new AtomicBoolean(true); b.ToBoolean().Should().BeTrue(); }
public void ToBoolean_Should_Return_False() { var b = new AtomicBoolean(false); b.ToBoolean().Should().BeFalse(); }
public void Static_ToBoolean_Should_Return_True() { var b = new AtomicBoolean(true); AtomicBoolean.ToBoolean(b).Should().BeTrue(); }
public void Static_ToBoolean_Should_Return_False() { var b = new AtomicBoolean(false); AtomicBoolean.ToBoolean(b).Should().BeFalse(); }
public void Set_Should_Set_New_Value() { var b = new AtomicBoolean(false); b.Set(true); b.Value.Should().BeTrue(); }