public void CreateNewRefernce() { Mock <IObjectCreator> creatorMock = new Mock <IObjectCreator>(); var target = new ReferenceInfo(5); SampleClass sampleObject = new SampleClass(); creatorMock.Setup(o => o.GetObjectReference(target)).Returns(sampleObject); var result = target.GetInstance(creatorMock.Object); Assert.IsInstanceOfType(result, typeof(SampleClass)); }