Example #1
0
        public async Task TestDeleteJObAsyncTest()
        {
            ApplicationUser user     = new ApplicationUser();
            Category        category = new Category();
            var             options  = new DbContextOptionsBuilder <ApplicationDbContext>()
                                       .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository  = new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var studentRepo = new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var job         = new Job
            {
                ApplicationUser = user,
                Salary          = 900,
                Description     = "test",
            };
            await repository.AddAsync(job);

            await repository.SaveChangesAsync();

            var studentJob = new StudentJob
            {
                Job             = job,
                ApplicationUser = user,
            };

            await studentRepo.AddAsync(studentJob);

            var jobService = new JobsService(repository, studentRepo);

            AutoMapperConfig.RegisterMappings(typeof(MyTestJob).Assembly);
            Assert.Throws <Exception>(() => jobService.DeleteAsync(3516516).GetAwaiter().GetResult());
        }
Example #2
0
        public async Task IsUserApplied_WithCorrectData_ShouldReturnCorrectResult()
        {
            var errorMessage = "JobsService IsUserApplied() method does not work properly.";

            // Arrange
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            var applicationsRepository = new EfRepository <Application>(context);

            var userManager = this.GetUserManagerMock();

            var jobsService = new JobsService(applicationsRepository, userManager.Object);

            var userId = Guid.NewGuid().ToString();

            var applicationModel = new ApplicationInputModel
            {
                Age         = 18,
                Name        = "Nikola",
                Country     = "Bulgaria",
                Position    = GlobalConstants.BoosterRoleName,
                Rank        = "Diamond 2",
                Champions   = "Katarina, Yasuo",
                Description = "Very good midlaner",
            };

            // Act
            await jobsService.CreateAsync(applicationModel, userId);

            var result = jobsService.IsUserApplied(userId);

            // Assert
            Assert.True(result, errorMessage);
        }
Example #3
0
        /// <summary>
        ///     This method initializes the NeverBounceSDK
        /// </summary>
        /// <param name="ApiKey">The api key to use to make the requests</param>
        /// <param name="Host">Specify a different host to make the request to. Leave null to use 'https://api.neverbounce.com'</param>
        /// <param name="Client">An instance of IHttpClient to use; useful for mocking HTTP requests</param>
        public NeverBounceSdk(string ApiKey, string Host = null, IHttpClient Client = null)
        {
            _apiKey = ApiKey;

            // Accept debug host
            if (Host != null)
            {
                _host = Host;
            }

            // Check for mocked IHttpClient, if none exists create default
            if (Client == null)
            {
                _client = new HttpClientWrapper();
            }
            else
            {
                _client = Client;
            }

            Account = new AccountService(_client, _apiKey, _host);
            Jobs    = new JobsService(_client, _apiKey, _host);
            POE     = new POEService(_client, _apiKey, _host);
            Single  = new SingleService(_client, _apiKey, _host);
        }
Example #4
0
        public void TestSearchJobs()
        {
            ApplicationUser user     = new ApplicationUser();
            Category        category = new Category();
            var             options  = new DbContextOptionsBuilder <ApplicationDbContext>()
                                       .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository  = new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var studentRepo = new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));

            repository.AddAsync(new Job
            {
                ApplicationUser = user,
                Salary          = 900,
                Description     = "test",
            });
            repository.SaveChangesAsync().GetAwaiter().GetResult();
            var jobService = new JobsService(repository, studentRepo);

            AutoMapperConfig.RegisterMappings(typeof(MyTestJob).Assembly);
            var company = jobService.SearchJob("test");

            Assert.Equal("test", company.Where(x => x.ApplicationUserId == user.Id)
                         .Select(x => x.Description)
                         .FirstOrDefault());
        }
        public async Task FetchData_GivenPreviousLastModified_DataShouldNotBeUpdated()
        {
            var serviceMockFactory = new ServiceMockFactory();
            var dataService        = serviceMockFactory.GetDataService();
            var mapper             = serviceMockFactory.GetMapper();
            var context            = new InMemoryDbContextFactory().GetArticleDbContext();
            var jobService         = new JobsService(dataService, context, mapper);

            await jobService.FetchHeaders();

            await jobService.FetchData();

            var updatedDataService = serviceMockFactory.
                                     GetDataService("Sun, 29 Mar 2020 14:23:25 GMT",
                                                    TestContext.CurrentContext.TestDirectory + "\\Data\\UpdatedTestData.xml");

            var updatedJobService = new JobsService(updatedDataService, context, mapper);

            await updatedJobService.FetchHeaders();

            await updatedJobService.FetchData();

            var dataServiceWithNewEntry = serviceMockFactory.
                                          GetDataService("Sat, 28 Mar 2020 12:23:25 GMT",
                                                         TestContext.CurrentContext.TestDirectory + "\\Data\\UpdatedTestDataWithNewEntry.xml");

            updatedJobService = new JobsService(dataServiceWithNewEntry, context, mapper);

            await updatedJobService.FetchHeaders();

            await updatedJobService.FetchData();

            context.SdnEntities.Count().Should().NotBe(0);
            context.SdnEntities.Select(s => s.LastName).Should().NotContain("Aml-Analytics");
        }
Example #6
0
        public IndexPage()
        {
            List <Data.Models.Jobs> jobs = JobsService.ListAll();

            Dictionary <int, string> source = new Dictionary <int, string>();

            foreach (Data.Models.Jobs job in jobs)
            {
                source.Add(job.JobId, $"{job.JobId.ToString("0000000")} :: {job.JobName}");
            }

            ListView listView = new ListView
            {
                ItemsSource = source.Select(q => q.Value)
            };

            listView.ItemTapped += (sender, e) =>
            {
                string title   = (string)((ListView)sender).SelectedItem;
                int    jobId   = source.FirstOrDefault(q => q.Value == title).Key;
                string message = jobs.FirstOrDefault(q => q.JobId == jobId).Description;

                DisplayAlert(title, message, jobId);

                ((ListView)sender).SelectedItem = null;
            };

            Content = listView;
        }
Example #7
0
        public SuccessPage(int jobId)
        {
            // After loading MainPage it gets navigated to the MenuPage
            Application.Current.MainPage = new MenuPage();

            Data.Models.Jobs job = JobsService.ListAll().FirstOrDefault(q => q.JobId == jobId);

            Button backButton = new Button {
                Text = "BACK HOME", HorizontalOptions = LayoutOptions.FillAndExpand
            };

            backButton.Clicked += (sender, e) =>
            {
                Application.Current.MainPage = new MenuPage();
            };

            Content = new StackLayout
            {
                Margin   = new Thickness(10, 5),
                Children =
                {
                    new Image {
                        Source = "header.jpg", Aspect = Aspect.AspectFill
                    },
                    new Label {
                        Text = $"You have successfully applied for the position of {job.JobName}.", Margin = new Thickness(30, 1), FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center
                    },
                    backButton
                }
            };
        }
        public InventoryLookupItem(Inventory inventory, BadgerDataModel ctx)
        {
            if (inventory == null)
            {
                return;
            }
            _context        = ctx;
            jobService      = new JobsService(_context);
            orderService    = new OrdersService(_context);
            recieptService  = new OrderRecieptService(_context);
            employeeService = new EmployeeService(_context);

            po = orderService.GetOrderByID(recieptService.GetOrderReciept
                                               (inventory.OrderReceiptID.Value).OrderNum.Value);
            job = jobService.Find(inventory.JobId.Value);

            receipt = recieptService.GetOrderReciept(inventory.OrderReceiptID.Value);
            emp     = employeeService.Find(receipt.EmployeeId.Value);

            orderNum        = po.OrderNum.ToString();
            orderDate       = po.OrderDate.Value.ToShortDateString();
            jobName         = job.Jobname.ToString();
            quantity        = inventory.Qnty.ToString();
            unitCost        = "0.0";
            itemDescription = inventory.Description;
            supplierName    = po.Supplier.SupplierName.ToString();
            receivedDate    = receipt.ReceiptDate.Value.ToShortDateString();
            receivedBy      = emp.Firstname + " " + emp.Lastname;
            orderedBy       = po.Employee.Firstname.ToString() + " " + po.Employee.Lastname.ToString();
        }
Example #9
0
        public void TestGetCountByCategoryId()
        {
            ApplicationUser user     = new ApplicationUser();
            Category        category = new Category();
            var             options  = new DbContextOptionsBuilder <ApplicationDbContext>()
                                       .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository  = new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var studentRepo = new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var job         = new Job
            {
                ApplicationUser = user,
                Salary          = 900,
                Description     = "test",
                Category        = category,
            };

            repository.AddAsync(job);
            repository.SaveChangesAsync().GetAwaiter().GetResult();
            var jobService = new JobsService(repository, studentRepo);

            AutoMapperConfig.RegisterMappings(typeof(MyTestJob).Assembly);
            var jobs = jobService.GetCountByCategoryId(category.Id);

            Assert.Equal(1, jobs);
        }
        public async Task FetchData_UpdatedLastModified_FetchesDataTwice()
        {
            var serviceMockFactory = new ServiceMockFactory();
            var dataService        = serviceMockFactory.GetDataService();
            var mapper             = serviceMockFactory.GetMapper();
            var context            = new InMemoryDbContextFactory().GetArticleDbContext();
            var jobService         = new JobsService(dataService, context, mapper);

            await jobService.FetchHeaders();

            await jobService.FetchData();

            var updatedDataService = serviceMockFactory.
                                     GetDataService("Sun, 29 Mar 2020 14:23:25 GMT",
                                                    TestContext.CurrentContext.TestDirectory + "\\Data\\UpdatedTestData.xml");

            var updatedJobService = new JobsService(updatedDataService, context, mapper);

            await updatedJobService.FetchHeaders();

            await updatedJobService.FetchData();

            context.SdnEntities.Count().Should().NotBe(0);
            context.SdnEntities.FirstOrDefault().SdnType.Should().Be("NewType");
        }
        public void TestsTakeAndDeleteUser()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository =
                new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options.Options));
            var studentEfRepository =
                new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var userSkillRepository =
                new EfRepository <UsersSkill>(new ApplicationDbContext(options.Options));
            var jobRepository =
                new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var jobService      = new JobsService(jobRepository, studentEfRepository);
            var skillRepository =
                new EfDeletableEntityRepository <Skill>(new ApplicationDbContext(options.Options));
            var skillService = new SkillsService(skillRepository, userSkillRepository);
            var usersService = new ApplicationUsersService(repository, jobService, studentEfRepository, jobRepository,
                                                           skillService, userSkillRepository, skillRepository);
            var user = new ApplicationUser
            {
                Description = "test",
                Type        = UserType.Employer,
            };

            repository.AddAsync(user).GetAwaiter().GetResult();
            repository.SaveChangesAsync().GetAwaiter().GetResult();
            AutoMapperConfig.RegisterMappings(typeof(CompaniesServiceTests.MyTest).Assembly);
            usersService.DeleteAsync(user.Id).GetAwaiter().GetResult();
            Assert.Empty(repository.All());
            repository.Delete(user);
            repository.SaveChangesAsync().GetAwaiter().GetResult();
        }
        public void TestGetCompaniesCount()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository =
                new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options.Options));
            var studentEfRepository =
                new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var userSkillRepository =
                new EfRepository <UsersSkill>(new ApplicationDbContext(options.Options));
            var jobRepository =
                new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var jobService      = new JobsService(jobRepository, studentEfRepository);
            var skillRepository =
                new EfDeletableEntityRepository <Skill>(new ApplicationDbContext(options.Options));
            var skillService = new SkillsService(skillRepository, userSkillRepository);
            var usersService = new ApplicationUsersService(repository, jobService, studentEfRepository, jobRepository, skillService, userSkillRepository, skillRepository);

            AutoMapperConfig.RegisterMappings(typeof(CompaniesServiceTests.MyTest).Assembly);
            var user = new ApplicationUser
            {
                FullName = "IvanIvanov",
                Email    = "test@test",
                Type     = UserType.Employer,
            };

            repository.AddAsync(user);
            repository.SaveChangesAsync();
            Assert.Equal(1, usersService.GetCompaniesCount());
            repository.Delete(user);
            repository.SaveChangesAsync();
        }
Example #13
0
        protected override void ProcessResponse(T request, Dictionary <string, object> response)
        {
            int JobId      = request.Id;
            int WaypointId = request.JobWaypoints[0].Id;

            IDictionary <string, JToken> task = null;
            int ExternalJobId      = 0;
            int ExternalWaypointId = 0;

            // we go into the object that is returned by Bringg, and we extract the data we want for our database
            if (response.ContainsKey("task"))
            {
                task = (JObject)response["task"];
                if (task.ContainsKey("id"))
                {
                    ExternalJobId      = (int)task["id"];
                    ExternalWaypointId = (int)task["active_way_point_id"];
                }
            }

            //this changes ExternalJobId from null to this value
            JobsService.UpdateExternalJobId(JobId, ExternalJobId);
            //this is the first waypoint in the job. Other waypoints can be added with CreateWaypoint
            JobsService.UpdateExternalWaypointId(WaypointId, ExternalWaypointId);
        }
Example #14
0
        public async Task MultipleKeys()
        {
            int    code   = 4865846;
            String vcode  = "t99aNY7KfAMRUxCz7S29ZkPvBEwVjrYwtWdgGVXFYKq0lHAWtIlpwuiVqxZpnwBT";
            long   code2  = 3645238;
            string vcode2 = "sLOD3pSHwuzKtml3inm59qvVWHiKA3rULJY7KRsuWmmHrZ0c8qAZlftLDQIHvxBq";
            long   code3  = 3227994;
            string vcode3 = "MMIm45tf04n2xlhK0DQNO8FaL3CdYO0KOCnVobAajkwtJIvGXyvbI4DNf0BziWH8";

            var keyRepoMock = new Mock <IKeyInfoRepo>();

            keyRepoMock.Setup(x => x.GetKeys(1))
            .Returns(Task.FromResult((ICollection <KeyInfo>)(new KeyInfo[] { new KeyInfo()
                                                                             {
                                                                                 KeyId = code, VCode = vcode, KeyInfoId = code + 1
                                                                             }, new KeyInfo()
                                                                             {
                                                                                 KeyId = code2, VCode = vcode2, KeyInfoId = code2 + 1
                                                                             }, new KeyInfo()
                                                                             {
                                                                                 KeyId = code3, VCode = vcode3, KeyInfoId = code3 + 1
                                                                             } }.ToList())));

            var api     = EveApi;
            var service = new JobsService(keyRepoMock.Object, api, Logger, TypeNameDict, CharacterNameDict);

            var result = await service.Get(1);
        }
Example #15
0
        protected void Application_Start()
        {
            XmlConfigurator.Configure();

            ViewEngines.Engines.Clear();

            var razorViewEngine = new RazorViewEngine();

            razorViewEngine.ViewLocationCache = new TwoLevelViewCache(razorViewEngine.ViewLocationCache);
            ViewEngines.Engines.Add(razorViewEngine);

            ModelBinders.Binders.DefaultBinder = new SharpModelBinder();

            // ModelValidatorProviders.Providers.Add(new ClientDataTypeModelValidatorProvider());

            this.InitializeServiceLocator();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            JobsService.Instance().Start();

            if (KeepAliveMinutes > 0)
            {
                _keepAliveTimer          = new Timer(60000 * KeepAliveMinutes);
                _keepAliveTimer.Elapsed += new ElapsedEventHandler(KeepAlive);
                _keepAliveTimer.Start();
            }
        }
        public NewOrderDialog(BadgerDataModel context)
        {
            InitializeComponent();
            _context                  = context;
            _jobService               = new JobsService(_context);
            _supplierService          = new SuppliersService(context);
            tbSupplier.Validated     += TbSupplier_Validated;
            tbJobSelection.Validated += TbJobSelection_Validated;

            AutoCompleteStringCollection jobNames = new AutoCompleteStringCollection();

            foreach (var item in _jobService.All())
            {
                jobNames.Add(item.JobName);
            }
            this.tbJobSelection.AutoCompleteMode    = AutoCompleteMode.Suggest;
            this.tbJobSelection.AutoCompleteSource  = AutoCompleteSource.CustomSource;
            tbJobSelection.AutoCompleteCustomSource = jobNames;

            AutoCompleteStringCollection supplierNames = new AutoCompleteStringCollection();

            foreach (var item in _supplierService.GetAll())
            {
                supplierNames.Add(item.SupplierName);
            }
            this.tbSupplier.AutoCompleteMode    = AutoCompleteMode.Suggest;
            this.tbSupplier.AutoCompleteSource  = AutoCompleteSource.CustomSource;
            tbSupplier.AutoCompleteCustomSource = supplierNames;
            CheckState();
        }
        public void TestAddExistUserinSkill()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository =
                new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options.Options));
            var studentEfRepository =
                new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var userSkillRepository =
                new EfRepository <UsersSkill>(new ApplicationDbContext(options.Options));
            var jobRepository =
                new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var jobService      = new JobsService(jobRepository, studentEfRepository);
            var skillRepository =
                new EfDeletableEntityRepository <Skill>(new ApplicationDbContext(options.Options));
            var skillService = new SkillsService(skillRepository, userSkillRepository);
            var usersService = new ApplicationUsersService(repository, jobService, studentEfRepository, jobRepository, skillService, userSkillRepository, skillRepository);
            var user         = new ApplicationUser
            {
                Description = "test",
                Type        = UserType.Student,
            };
            var skill = new Skill
            {
                Name = "test",
            };

            skillRepository.AddAsync(skill).GetAwaiter().GetResult();
            skillRepository.SaveChangesAsync().GetAwaiter().GetResult();
            repository.AddAsync(user).GetAwaiter().GetResult();
            repository.SaveChangesAsync().GetAwaiter().GetResult();
            AutoMapperConfig.RegisterMappings(typeof(CompaniesServiceTests.MyTest).Assembly);
            Assert.Throws <ArgumentException>(() => usersService.AddSkillAsync(skill.Id, user.Id).GetAwaiter().GetResult());
        }
Example #18
0
        public async Task TestEditJobAsync()
        {
            ApplicationUser user     = new ApplicationUser();
            Category        category = new Category();
            var             options  = new DbContextOptionsBuilder <ApplicationDbContext>()
                                       .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository  = new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var studentRepo = new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var job         = new Job
            {
                ApplicationUser = user,
                Salary          = 900,
                Description     = "test",
                Category        = category,
            };
            await repository.AddAsync(job);

            await repository.SaveChangesAsync();

            var jobService = new JobsService(repository, studentRepo);

            AutoMapperConfig.RegisterMappings(typeof(MyTestJob).Assembly);
            await jobService.EditAsync(job.Id, "Junior", "Pleven", "Junior", "Remote", 80000);

            var newJob = jobService.GetJobById <MyTestJob>(job.Id);

            Assert.Equal("Pleven", newJob.Location);
        }
        public JobListViewModel(INavigation navigation)
        {
            _navigation = navigation;

            _jobsService = new JobsService();

            GetJobsNotifier = NotifyTask.Create(GetJobsAsync);
        }
Example #20
0
 public RssPullCommand(
     TelegramService telegramService,
     JobsService jobsService
     )
 {
     _telegramService = telegramService;
     _jobsService     = jobsService;
 }
 public OrderReceiptControl(OrderReciept receipt, BadgerDataModel ctx)
 {
     InitializeComponent();
     this._context = ctx;
     _receipt      = receipt;
     jService      = new JobsService(ctx);
     oService      = new OrdersService(ctx);
 }
Example #22
0
        public HttpResponseMessage Insert(JobStatus id)
        {
            string json = String.Empty;
            ActivityLogAddRequest add = new ActivityLogAddRequest();
            Job job = new Job();

            Dictionary <string, object> values = new Dictionary <string, object>();

            SuccessResponse response = new SuccessResponse();

            if (HttpContext.Current.Request.InputStream.Length > 0)
            {
                HttpContext.Current.Request.InputStream.Position = 0;
                using (var inputStream = new StreamReader(HttpContext.Current.Request.InputStream))
                {
                    json = inputStream.ReadToEnd();
                }

                jObj   = JObject.Parse(json);
                values = JsonConvert.DeserializeObject <Dictionary <string, object> >(json);

                int externalJobId = Convert.ToInt32(values["id"]);


                job = JobsService.GetByExternalJobId(externalJobId);

                add.JobId = job.Id;

                add.TargetValue  = (int)id;
                add.RawResponse  = Newtonsoft.Json.JsonConvert.SerializeObject(jObj);
                add.ActivityType = ActivityTypeId.BringgTaskStatusUpdated;

                //Need an if to check if the userId is null or not - If it is null, then use the Phone Nunber
                if (job.UserId != null)
                {
                    _ActivityLogService.Insert(job.UserId, add);
                }
                else
                {
                    job.UserId = job.Phone;
                    _ActivityLogService.Insert(job.UserId, add);
                }

                JobsService.UpdateJobStatus(id, externalJobId);
            }

            //Will call the CompleteTrancsaction function once delivery is done

            if (id == JobStatus.BringgDone)
            {
                _BrainTreeService.CompleteTransaction(job, add);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Example #23
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddSingleton <IJobsService, JobsService>();


            var         provider    = services.BuildServiceProvider();
            JobsService jobsService = provider.GetService <IJobsService>() as JobsService;

            jobsService.Start();
        }
Example #24
0
            public void Get_All_Job_list()
            {
                var ctx = new BadgerDataModel();


                JobsService service = new JobsService(ctx);

                var jobs = service.All();

                Assert.IsTrue(jobs.Count > 100);
            }
        public void Setup()
        {
            _fixture = new Fixture();

            _baseAddress = new Uri(@"http://localhost");
            _testClient  = new TestHttpClient(_baseAddress);

            _testClient.SetUpPutAsAsync(HttpStatusCode.OK);

            _sut = new JobsService(_testClient);
        }
        public async Task TestSetup()
        {
            var serviceMockFactory = new ServiceMockFactory();
            var dataService        = serviceMockFactory.GetDataService();
            var mapper             = serviceMockFactory.GetMapper();
            var context            = new InMemoryDbContextFactory().GetArticleDbContext();
            var jobService         = new JobsService(dataService, context, mapper);

            await jobService.FetchData();

            context.SdnEntities.Count().Should().NotBe(0);
        }
 public JobOrdersControl(BadgerDataModel ctx)
 {
     InitializeComponent();
     _context = ctx;
     dgJobOrders.AutoGenerateColumns     = false;
     dgJobOrderItems.AutoGenerateColumns = false;
     _jobService  = new JobsService(_context);
     _lineService = new LineItemsService(_context);
     // Use last entered search term ---
     txtJobNameSearch.Text = (InventoryFerret.Properties.Settings.Default.LastJobSearch != String.Empty)?
                             Properties.Settings.Default.LastJobSearch : string.Empty;
 }
Example #28
0
        public void GetJobInventory_ReturnInventoryItemRelatedToJob()
        {
            IInventoryService repo    = new InventoryService(new BadgerDataModel());
            JobsService       jobRepo = new JobsService(new BadgerDataModel());
            // Retrieve the original Job object
            int JobNumber = 106;
            Job jobToTest = jobRepo.Find(JobNumber);
            var result    = repo.GetJobInventory(jobToTest);



            Assert.IsTrue(result.Count == 1913);
        }
Example #29
0
 public RssFeedService(
     IRecurringJobManager recurringJobManager,
     ITelegramBotClient botClient,
     OctokitApiService octokitApiService,
     JobsService jobsService,
     RssService rssService
     )
 {
     _recurringJobManager = recurringJobManager;
     _botClient           = botClient;
     _octokitApiService   = octokitApiService;
     _jobsService         = jobsService;
     _rssService          = rssService;
 }
Example #30
0
        public void TestGetAllJobWithNullJobs()
        {
            ApplicationUser user = new ApplicationUser();

            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository  = new EfDeletableEntityRepository <Job>(new ApplicationDbContext(options.Options));
            var studentRepo = new EfRepository <StudentJob>(new ApplicationDbContext(options.Options));
            var jobService  = new JobsService(repository, studentRepo);

            AutoMapperConfig.RegisterMappings(typeof(JobServicesTests.MyTestJob).Assembly);

            Assert.Empty(jobService.GetAll <JobServicesTests.MyTestJob>());
        }