public void ShouldSupportIndexer()
        {
            var target = Mocks.Of <IBaz>().First(x => x["3", It.IsAny <bool>()] == 10);

            Assert.NotEqual(10, target["1", true]);
            Assert.Equal(10, target["3", true]);
            Assert.Equal(10, target["3", false]);
        }
예제 #2
0
        public void HashCodeIsDifferentForEachMock()
        {
            var mock1 = new Mock <IFoo>();
            var mock2 = new Mock <IFoo>();

            Assert.Equal(mock1.Object.GetHashCode(), mock1.Object.GetHashCode());
            Assert.Equal(mock2.Object.GetHashCode(), mock2.Object.GetHashCode());
            Assert.NotEqual(mock1.Object.GetHashCode(), mock2.Object.GetHashCode());
        }
예제 #3
0
        public void ExpectWithParamArrayNotMatchDifferentLengthInArguments()
        {
            string notExpected = "bar";
            string argument    = "foo";

            var target = new Mock <IParams>();

            target.Setup(x => x.ExecuteParams(argument, It.IsAny <string>())).Returns(notExpected);

            string actual = target.Object.ExecuteParams(argument);

            Assert.NotEqual(notExpected, actual);
        }