Ejemplo n.º 1
0
        private void VerifyEvent(BsonDocument content, ServerDescriptionChangedEvent @event)
        {
            @event.ClusterId.Should().Be(_cluster.ClusterId);
            var expectedEndPoint = EndPointHelper.Parse(content["address"].ToString());

            EndPointHelper.EndPointEqualityComparer.Equals(@event.ServerId.EndPoint, expectedEndPoint)
            .Should().BeTrue();
        }
Ejemplo n.º 2
0
        private void VerifyEvent(ServerDescriptionChangedEvent actualEvent, BsonDocument expectedEvent)
        {
            VerifyFields(expectedEvent, "address", "newDescription", "previousDescription", "topologyId");
            var expectedEndPoint = EndPointHelper.Parse(expectedEvent["address"].AsString);

            actualEvent.ClusterId.Should().Be(_cluster.ClusterId);
            actualEvent.ServerId.EndPoint.WithComparer(EndPointHelper.EndPointEqualityComparer).Should().Be(expectedEndPoint);
            VerifyServerDescription(actualEvent.OldDescription, expectedEvent["previousDescription"].AsBsonDocument);
            VerifyServerDescription(actualEvent.NewDescription, expectedEvent["newDescription"].AsBsonDocument);
        }
Ejemplo n.º 3
0
 // private method
 private void AssertEvent(ServerDescriptionChangedEvent @event, EndPoint expectedEndPoint, ServerType expectedServerType, string expectedReasonStart, Type exceptionType = null)
 {
     @event.ServerId.ClusterId.Should().Be(__clusterId);
     @event.NewDescription.EndPoint.Should().Be(expectedEndPoint);
     @event.NewDescription.Type.Should().Be(expectedServerType);
     @event.NewDescription.State.Should().Be(expectedServerType == ServerType.Unknown ? ServerState.Disconnected : ServerState.Connected);
     if (exceptionType != null)
     {
         @event.NewDescription.HeartbeatException.Should().BeOfType(exceptionType);
     }
     else
     {
         @event.NewDescription.HeartbeatException.Should().BeNull();
     }
     @event.NewDescription.ReasonChanged.Should().StartWith(expectedReasonStart);
 }
Ejemplo n.º 4
0
 private void Handle(ServerDescriptionChangedEvent @event)
 {
     Debug(TraceSourceEventHelper.ServerIdBase + 7, "{0}: {1}", TraceSourceEventHelper.Label(@event.OldDescription.ServerId), @event.NewDescription);
 }
 // private method
 private void AssertEvent(ServerDescriptionChangedEvent @event, EndPoint expectedEndPoint, ServerType expectedServerType, string expectedReasonStart, (Type ExceptionType, string ExceptionMessage)?exceptionInfo = null)