Is that bug or known behavior?
using System;
using NSubstitute;
using NUnit.Framework;
namespace TestTimer.Test
{
public interface IInterface
{
bool TryGet(ulong id, out DateTime value);
}
[TestFixture]
public class Test
{
[Test]
public void Test1()
{
var mock = Substitute.For<IInterface>();
DateTime value1;
DateTime value2;
DateTime value3;
mock.TryGet(Arg.Is<ulong>(100), out value1).Returns(x => { x[1] = new DateTime(100); return true; });
mock.TryGet(Arg.Is<ulong>(200), out value2).Returns(x => { x[1] = new DateTime(200); return true; });
mock.TryGet(Arg.Is<ulong>(300), out value3).Returns(x => { x[1] = new DateTime(300); return true; });
DateTime resValue;
var res1 = mock.TryGet(100, out resValue);
Assert.IsTrue(res1);
var res2 = mock.TryGet(200, out resValue);
Assert.IsTrue(res2); // NOTE: Will fail here because resValue is already assigned
var res3 = mock.TryGet(300, out resValue);
Assert.IsTrue(res3);
}
}
}
--
You received this message because you are subscribed to the Google Groups "NSubstitute" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nsubstitute...@googlegroups.com.
To post to this group, send email to nsubs...@googlegroups.com.
Visit this group at http://groups.google.com/group/nsubstitute.
For more options, visit https://groups.google.com/d/optout.