public static void SetMock(DependencyDescriptor instance)
        {
            var mock = new Mock <IServiceProviderWrapper>();

            mock.Setup(s => s.GetService(It.IsAny <Type>()))
            .Returns <object>(r => instance.RequestType == (Type)r ? instance.Service : null);

            DependencyResolver.Init(mock.Object);
        }
Esempio n. 2
0
        public static IDependencyService GetMock(DependencyDescriptor instance)
        {
            var mock = new Mock <IDependencyService>();

            mock.Setup(s => s.GetService(It.IsAny <Type>()))
            .Returns <object>(r => instance.RequestType == (Type)r ? instance.Service : null);

            return(mock.Object);
        }