public void GetAllInstances_CorrectlyCallsContainerWithKey()
        {
            var instances = new IType1[0];

            var mockContainer = new Mock <IContainer>();

            mockContainer.Setup(x => x.GetAllInstances(It.IsAny <Type>(), It.IsAny <string>()))
            .Returns(instances);

            var actual = mockContainer.Object.GetAllInstances <IType1>(SampleKey);

            Assert.AreSame(instances, actual);

            mockContainer.Verify(x => x.GetAllInstances(It.IsAny <Type>(), It.IsAny <string>()), Times.Once);
            mockContainer.Verify(x => x.GetAllInstances(typeof(IType1), SampleKey), Times.Once);
        }
示例#2
0
 public MyOtherClass(IType1 type1, IType2 type2, IType3 type3)
 {
     Type1 = type1;
     Type2 = type2;
     Type3 = type3;
 }