Exemplo n.º 1
0
        public void should_report_speed_for_given_method(ReportingMethod reportingMethod)
        {
            reportingMethod.EnqueueMethod(_speedReporter, 1.Second());
            reportingMethod.EnqueueMethod(_speedReporter, 2.Second());
            reportingMethod.EnqueueMethod(_speedReporter, 3.Second());

            reportingMethod.RetrievalMethod(_speedReporter).SequenceEqual(new[] { 1.Second(), 2.Second(), 3.Second() }).ShouldBeTrue();
            reportingMethod.RetrievalMethod(_speedReporter).ShouldBeEmpty();
        }
        protected override OpResult _Store(ReportingMethod _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "ReportingMethod object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            _obj.FromDb = true;

            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
 private DbUpdateStatement GetQuery_UpdateQuery(ReportingMethod _obj)
 {
     return(DbMgr.CreateUpdateClause("ReportingMethod", GetFields(_obj), "ReportingMethodID", _obj.ReportingMethodID));
 }
        private DbInsertStatement GetQuery_InsertQuery(ReportingMethod _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("ReportingMethod", fields));
        }
        private void PrepareDialog()
        {
            CheckDisposed();
            Font = SystemFonts.MessageBoxFont;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            _emailAddress.Text = ErrorReport.EmailAddress;
            SetupMethodCombo();

            foreach (ReportingMethod  method in _methodCombo.Items)
            {
                if (ErrorReportSettings.Default.ReportingMethod == method.Id)
                {
                    SelectedMethod = method;
                    break;
                }
            }

            if (!_isLethal)
            {
                BackColor = Color.FromArgb(255, 255, 192); //yellow
                _notificationText.Text = "Take Courage. It'll work out.";
                _notificationText.BackColor = BackColor;
                _pleaseHelpText.BackColor = BackColor;
                textBox1.BackColor = BackColor;
            }

            SetupCloseButtonText();
        }