Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi folks,

we really appreciate the lib and want to use it, but we are currently facing some hard times testing our code using your lib. The lib provides too less interfaces. Also, constructing a new Connection directly establishes a socket. Therefore it is simply not mock-/testable. As we are developing in a CI environment, we strongly need to provide unittests (not only integrationtests).

Do you think there is a chance to introduce an appropiate level of abstraction?

Thanks in advance Andy

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

xinchen10commented, Jun 15, 2017

Hi everyone, based on the feedback and sample PR, I pushed some code to the api-updates branch. There you will find the public interfaces (sync part in IAmqpObject.cs, async part in TaskExtensions.cs and also IConnectionFactory.cs). This should cover most of the APIs on the client side. I didn’t include all public methods to minimize the changes. Please let me know if you feel any changes are needed. Thanks a lot.

peteraritchiecommented, Jun 12, 2017

I added a throw-away PR that shows an example of adding interface to support this concept. From a testability standpoint, for example, this is the type of thing I would be hopping to accomplish without having to create a bunch of my own interfaces and wrappers around the amqpnetlite classes:

	public void DoesReceiverReceiveFromAmqpCorrectly()
		// test-specific code
		IReceiverMessage messageReceived = null;
		var waitHandle = new ManualResetEventSlim();

		// create a mock receiver link to simulate a message
		// actually coming through receiver link as soon
		// as a message is requested
		var mockReceiverLink = new Mock<IReceiverLink>();
		mockReceiverLink.Setup(mock => mock.ReceiveAsync(It.IsAny<TimeSpan>())).Returns(Task.FromResult(new Message("my body")));

		// create our home-grown event-driven class instance
		var r = new AmqpReceiver(mockReceiverLink.Object, "queueName");

		// hook up event handler
		r.MessageReceived += (sender, e) =>
			messageReceived = e.Message;

		// start the "listener"

		// assert our constraints
		Assert.Equal("my body", messageReceived.GetStringValue(Encoding.UTF8));
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Testability in Software Testing?
Testability enables easy assessment and determining the overall efforts required to perform testing activities on the software, covering test ...
Read more >
Software testability
Software testability is the degree to which a software artifact (i.e. a software system, software module, requirements- or design document) supports testing ...
Read more >
Testability - an overview | ScienceDirect Topics
Testability : Testability is a characteristic that indicates whether a system or component can accurately determine its status (operation, failure, ...
Read more >
Software Testability
Testability is the ease with which a system can be tested. It enables easy assessment and determining the overall efforts required for ...
Read more >
Testability - How to Create a Scientific Theory or Hypothesis
Whenever you create a hypothesis to prove a part of a theory, it must be testable and analyzable with current technology. Reasoning Cycle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found