public void TestNoDefaultValidationAvailable()
        {
            // Need to move to :InterceptAttribute
            IOCContainer.Configure();
            var provider = IOCContainer.Get <Orchestration>();

            provider.UpdateEmployee(null);
        }
        public void TestDefaultOrchastrationFail()
        {
            var sampleRq = new EmployeeBuilder().JohnDoe().DateInFuture().BuildAddRequest();

            // Need to move to :InterceptAttribute
            IOCContainer.Configure();
            var provider = IOCContainer.Get <Orchestration>();

            provider.AddEmployee(sampleRq);
        }
        public void TestValidationSuccessfull()
        {
            var sampleRq = new EmployeeBuilder().JohnDoe().BuildAddRequest();

            // Need to move to :InterceptAttribute
            IOCContainer.Configure();
            var provider = IOCContainer.Get <Orchestration>();

            var outcome = provider.AddEmployee(sampleRq);

            Assert.IsTrue(outcome);
        }
Esempio n. 4
0
        /// <summary>
        /// Finds existing username with password, if not exists checks if external authorization service
        /// allows to authorize. If yes, creates new user.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public override async Task <T> FindAsync(string userName, string password)
        {
            var user = await base.FindAsync(userName, password);

            if (user != null)
            {
                return(user);
            }

            var externalAuthorizationService = IOCContainer.Get <IAuthorizationService>();

            if (externalAuthorizationService == null ||
                !externalAuthorizationService.Authorize(userName, password))
            {
                return(null);
            }

            var externalUser = externalAuthorizationService.Find(userName, password);

            user = new T
            {
                ExternalUserId = externalUser.Id,
                FirstName      = externalUser.FirstName,
                LastName       = externalUser.LastName,
                UserName       = externalUser.UserName,
                Email          = externalUser.Email
            };

            var result = await CreateAsync(user, password);

            if (!result.Succeeded)
            {
                return(null);
            }

            return(await base.FindAsync(userName, password));
        }
Esempio n. 5
0
 public T1 GetSystem <T1>() where T1 : class, ISystem
 {
     return(_container.Get <T1>());
 }
Esempio n. 6
0
        public MainForm()
        {
            InitializeComponent();

            // @STUPID(final): Visual studio designer is so stupid, it cannot recognize usercontrols properly
            // so we need to manually add it ourself -.-
            lvDoxygenIssues                  = new FilterListView();
            lvDoxygenIssues.Dock             = DockStyle.Fill;
            lvDoxygenIssues.ItemDoubleClick += Issues_ItemDoubleClick;
            SetupIssueColumns(lvDoxygenIssues);
            tpDoxygenIssues.Controls.Add(lvDoxygenIssues);
            _doxygenIssuesFilterControl = new FilterBarControl(lvDoxygenIssues);
            _doxygenIssuesFilterControl.ChangedFilter += (s, e) =>
            {
                lvDoxygenIssues.FilterText = e;
            };

            lvCppIssues                  = new FilterListView();
            lvCppIssues.Dock             = DockStyle.Fill;
            lvCppIssues.ItemDoubleClick += Issues_ItemDoubleClick;
            SetupIssueColumns(lvCppIssues);
            tpCppIssues.Controls.Add(lvCppIssues);

            _cppIssuesFilterControl = new FilterBarControl(lvCppIssues);
            _cppIssuesFilterControl.ChangedFilter += (s, e) =>
            {
                lvCppIssues.FilterText = e;
            };

            lvPerformance.ListViewItemSorter = new PerformanceListViewItemComparer();

            FileVersionInfo verInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);

            _appName = verInfo.ProductName;

            _configService = IOCContainer.Get <IConfigurationService>();
            _workspace     = new WorkspaceModel();
            _workspace.Load(_configService);

            // Update UI from config settings
            miViewShowWhitespaces.Checked = _workspace.IsWhitespaceVisible;
            RefreshRecentFiles();

            _searchControl = new SearchReplace.SearchReplaceControl();
            Controls.Add(_searchControl);

            TextSelectedTimer = new System.Windows.Forms.Timer()
            {
                Enabled = true, Interval = 500
            };
            TextSelectedTimer.Tick += (s, e) =>
            {
                if (tcFiles.TabPages.Count > 0)
                {
                    Debug.Assert(tcFiles.SelectedTab != null);
                    EditorState editorState = (EditorState)tcFiles.SelectedTab.Tag;
                    UpdateMenuSelection(editorState);
                }
                else
                {
                    UpdateMenuSelection(null);
                }
            };
            NativeMethods.AddClipboardFormatListener(Handle);
        }
Esempio n. 7
0
        public static string FormatErrorMessage(this Exception exception)
        {
            var exceptionProvider = IOCContainer.Get <IExceptionProvider>();

            return(exceptionProvider.HandleException(exception).Trim());
        }