public ServiceProviderFixture()
        {
            /* For unit test by local machine (using localdb) */
            //string connectionString = "Server=(localdb)\\mssqllocaldb;Database=com.danliris.db.spinning.test;Trusted_Connection=True;";

            /* For unit test by Travis CI (using docker container mssql) */
            string connectionString = "Server=localhost,1401;Database=com.danliris.db.spinning.test;User=sa;password=Standar123;MultipleActiveResultSets=true;";

            this.ServiceProvider = new ServiceCollection()

                                   .AddDbContext <SpinningDbContext>((serviceProvider, options) =>
            {
                options.UseSqlServer(connectionString);
            }, ServiceLifetime.Transient)
                                   .AddTransient(provider => new YarnService(provider))
                                   .AddTransient(provider => new WinderOutputProductionService(provider))
                                   .AddTransient <YarnServiceDataUtil>()
                                   .AddTransient <WinderOutputProductionServiceDataUtil>()
                                   .BuildServiceProvider();

            SpinningDbContext dbContext = ServiceProvider.GetService <SpinningDbContext>();

            dbContext.Database.Migrate();
        }
 public YarnServiceDataUtil(SpinningDbContext dbContext, YarnService yarnService)
 {
     this.DbContext   = dbContext;
     this.YarnService = yarnService;
 }
 public WinderOutputProductionServiceDataUtil(SpinningDbContext dbContext, WinderOutputProductionService winderOutputProductionService)
 {
     this.DbContext = dbContext;
     this.WinderOutputProductionService = winderOutputProductionService;
 }