Exemplo n.º 1
0
        public void Out_CustomType()
        {
            var moq = new Mock <AnInterface>();
            var sut = new AFunctionClass(moq.Object);

            var outValue = new ACustomType(42);

            moq.Setup(x => x.AFunctionCustomOut(out outValue));

            Assert.Equal <int>(42, sut.Call_AFunctionCustomOut());
        }
Exemplo n.º 2
0
        public void Ref_CustomType()
        {
            var moq = new Mock <AnInterface>();
            var sut = new AFunctionClass(moq.Object);

            Assert.Equal <int>(10, sut.Call_AFunctionCustomRef());

            moq.Setup(x => x.AFunctionCustomRef(ref It.Ref <ACustomType> .IsAny))
            .Callback(new CustomRefCallback((ref ACustomType param) => param = new ACustomType(42)));

            Assert.Equal <int>(42, sut.Call_AFunctionCustomRef());
        }