August 2009 - Posts

Update 2009-09-11: I was playing with the sample provided in two comments, and has run into issue with chunking binding. See thread: http://code.msdn.microsoft.com/msmqpluswcf/Thread/View.aspx?ThreadId=2265

Has anyone dealt with this issue before? We are running into a problem when our system has to use queues, but files can be more than 10MB.

I have googled around, and found a few things about MSMQ/T (BizTalk related/unrelated), but nothing concrete (example).

Has anyone had some production code with messages more than 4MB using MSMQ/T and can point to the right resources? Thank you.

Related to the recent post comments – this is the *REAL* thing :D

I was working on some code today, when run into a pitfall with Moq. This was probably my misreading of documentation.

The component I was testing looked somewhat like the code below

public class SomeOtherType
{
private readonly ISomeType someType;

public SomeOtherType(ISomeType someType)
{
this.someType = someType;
}

public string Do()
{
return "And it was: " + someType.ToString();
}
}

where dependency in injected and .ToString() method is invoked on it to construct the final result.

Specification looked quiet simple

[Concern(typeof (SomeType))]
[TestFixture]
public class ToStringMoqIssue : StaticContextSpecification
{
private Mock<ISomeType> dependency = new Mock<ISomeType>();
private string result;

protected override void establish_context()
{
dependency.Setup(x => x.ToString()).Returns("dependency");
}

protected override void because()
{
result = new SomeOtherType(dependency.Object).Do();
}

[Observation]
public void Should_return_And_it_worked()
{
result.Should_Be_Equal_To("And it was: dependency");
}
}

Dependency contract was dead simple

  public interface ISomeType
{
}

Observation is clear and simple. Yet I was getting an unexpected failure.

Expected Value : "And it was: dependency"
Actual Value   : "And it was: ISomeTypeProxy14b81655017446cc9f41c4740251e9c1"

Something obviously did not work right. Then I realized that ToString() is a method of Object and not of the Contract, and by default is assigned to any object (even if you reference it by the contract…). Update to the contract has fixed it.

public interface ISomeType
{
string ToString();
}

Reminder for myself – careful with ToString()!

More Posts