Esempio n. 1
0
        protected Mock <IServiceProvider> GetServiceProviderMock(SalesDbContext dbContext)
        {
            var serviceProviderMock = new Mock <IServiceProvider>();

            IIdentityService identityService = new IdentityService {
                Username = "******"
            };

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IdentityService)))
            .Returns(identityService);

            var weavingLogic = new WeavingSalesContractLogic(serviceProviderMock.Object, identityService, dbContext);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(WeavingSalesContractLogic)))
            .Returns(weavingLogic);

            return(serviceProviderMock);
        }