Exemplo n.º 1
0
        public void SendXyz_ReturnsSuccessful_IfRequestSuccessful()
        {
            Mock.Arrange(() => _connectionManager.SendDataRequest <object>(Arg.IsAny <string>(), Arg.IsAny <object[]>()))
            .Returns <string, object[]>(null);

            var result = _dataTransportService.Send(Arg.IsAny <EventHarvestData>(), Enumerable.Empty <TransactionEventWireModel>());

            Assert.AreEqual(DataTransportResponseStatus.RequestSuccessful, result);
        }
Exemplo n.º 2
0
        public void SendXyz_ConnectionHandler_DisconnectAndConnectAreCalled_ForCertainHttpStatusCodes(HttpStatusCode statusCode)
        {
            _connectionManager = new ConnectionManager(_connectionHandler, _scheduler);
            _disposableCollection.Add(_dataTransportService = new DataTransportService(_connectionManager, _dateTimeStatic, _agentHealthReporter));

            Mock.Arrange(() => _connectionHandler.SendDataRequest <object>(Arg.IsAny <string>(), Arg.IsAny <object[]>()))
            .Throws(new HttpException(statusCode, null));

            _dataTransportService.Send(Arg.IsAny <EventHarvestData>(), Enumerable.Empty <TransactionEventWireModel>());

            Mock.Assert(() => _connectionHandler.Disconnect(), Occurs.Once());
            Mock.Assert(() => _connectionHandler.Connect(), Occurs.Once());
        }