Пример #1
0
        public async Task GetQualificationsOnlineSucessNoItemsTest()
        {
            // Create the fake stockFeed:
            IQualificationDataService qualificationDataService =
                new StubIQualificationDataService
            {
                GetQualificationsString = s =>
                {
                    return(Task.Run(() => new DataResult <List <IQualification> >(Result.Ok)));
                }
            };
            IQualificationLocalStorageDataService qualificationLocalStorage =
                new StubIQualificationLocalStorageDataService
            {
                GetSavedQualifications = () =>
                {
                    return(Task.Run(() => new List <IQualification>()));
                },
                GetETag = () => null,
                SaveQualificationsListOfIQualification = list => { },
                SaveETagString = s => { }
            };
            var service       = new QualificationService(qualificationDataService, qualificationLocalStorage);
            var qualification = await service.GetQualifications();

            Assert.IsTrue(qualification.IsOk);
            Assert.IsTrue(qualification.Result == Result.Ok);
        }
        // GET: Qualification
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new QualificationService(userId);
            var model   = service.GetQualifications();

            return(View(model));
        }
        public QualificationListViewModel(QualificationService qualificationService)
        {
            _qualificationService = qualificationService;

            QualificationList = new ObservableCollection <QualificationViewModel>(
                _qualificationService.GetQualifications().Select(c =>
                                                                 new QualificationViewModel(c)));

            if (QualificationList.Count > 0)
            {
                SelectedQualification = QualificationList.First();
            }
        }
Пример #4
0
        public async Task GetQualificationsOnlineSucessWithItemsTest()
        {
            var qualificationMock = Ioc.Container.Resolve <IQualification>();

            qualificationMock.Name = "test1";
            var qualificationList = new List <IQualification>();

            qualificationList.Add(qualificationMock);

            IQualificationDataService qualificationDataService =
                new StubIQualificationDataService
            {
                GetQualificationsString = s =>
                {
                    return(Task.Run(() => new DataResult <List <IQualification> >(qualificationList)));
                }
            };

            IQualificationLocalStorageDataService qualificationLocalStorage =
                new StubIQualificationLocalStorageDataService
            {
                GetSavedQualifications = () =>
                {
                    return(Task.Run(() => new List <IQualification>()));
                },
                GetETag = () => null,
                SaveQualificationsListOfIQualification = list => { },
                SaveETagString = s => { }
            };

            var service       = new QualificationService(qualificationDataService, qualificationLocalStorage);
            var qualification = await service.GetQualifications();

            Assert.IsTrue(qualification.IsOk);
            Assert.IsTrue(qualification.Result == Result.Ok);
            Assert.IsTrue(qualification.Data.Count > 0);
        }
Пример #5
0
        public EditOpeningViewModel(OpeningViewModel openingToEdit,
                                    OpeningService openingService,
                                    CompanyService companyService,
                                    QualificationService qualificationService)
        {
            OpeningToEdit         = openingToEdit;
            _openingService       = openingService;
            _companyService       = companyService;
            _qualificationService = qualificationService;

            Companies      = new ObservableCollection <DataLayer.EfClasses.Company>(companyService.GetCompanies());
            Qualifications = new ObservableCollection <DataLayer.EfClasses.Qualification>(qualificationService.GetQualifications());

            SelectedCompany       = Companies.First(c => c.CompanyName == openingToEdit.CompanyName);
            SelectedQualification = Qualifications.First(c => c.QualificationCode == openingToEdit.Qualification);

            CopyEditableFields(openingToEdit);
        }
Пример #6
0
        public AddOpeningViewModel(OpeningService openingService, CompanyService companyService, QualificationService qualificationService)
        {
            _openingService       = openingService;
            _companyService       = companyService;
            _qualificationService = qualificationService;

            Companies      = new ObservableCollection <DataLayer.EfClasses.Company>(_companyService.GetCompanies());
            Qualifications = new ObservableCollection <DataLayer.EfClasses.Qualification>(_qualificationService.GetQualifications());

            SelectedCompany       = Companies.First();
            SelectedQualification = Qualifications.First();
        }