Ejemplo n.º 1
0
 internal override void PrepareForUpdate()
 {
     IgnoreProperties.Add(nameof(baccount));
     IgnoreProperties.Add("baccountId");
     IgnoreProperties.Add(nameof(locationId));
     base.PrepareForUpdate();
 }
        public void GameFilter()
        {
            //AreaRegistration.RegisterAllAreas();

            //WebApiConfig.Register(GlobalConfiguration.Configuration);
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            //AuthConfig.RegisterAuth();
            //Database.SetInitializer<SelectumContext>(new SelectumInitializer());
            Database.SetInitializer <SelectumContext>(null);

            int id = 0;

            // expecteds
            string messageToUser    = "******";
            var    resultsViewModel = new ResultsByGame();

            resultsViewModel.Results.Add(new ResultByGame());

            ResultsByGameController controller = new ResultsByGameController();
            ViewResult result = controller.GameFilter(id) as ViewResult;

            Assert.AreEqual(messageToUser, result.ViewBag.MessageToUser);

            IgnoreProperties ignoreProps = new IgnoreProperties();

            ignoreProps.Add(new PropertyComparisonExclusion(typeof(List <string>), "Capacity"));
            UnitTestingHelper.AssertPublicPropertiesEqual(resultsViewModel, result.Model, ignoreProps);
        }
Ejemplo n.º 3
0
        protected virtual void RaiseErrorsChanged(DataErrorsChangedEventArgs args)
        {
            OnPropertyChanged(Empty.HasErrorsChangedArgs);
            OnPropertyChanged(Empty.IsValidChangedArgs);
            OnPropertyChanged(Empty.IndexerPropertyChangedArgs);
            if (ErrorsChanged != null)
            {
                ThreadManager.Invoke(Settings.EventExecutionMode, this, args, RaiseErrorsChangedDelegate);
            }
#if NONOTIFYDATAERROR
            string ignoreProperty = args.PropertyName ?? string.Empty;
            lock (_locker)
            {
                //Disable validation to prevent cycle
                var contains = IgnoreProperties.Contains(ignoreProperty);
                if (!contains)
                {
                    IgnoreProperties.Add(ignoreProperty);
                }
                try
                {
                    OnPropertyChanged(ignoreProperty);
                }
                finally
                {
                    if (!contains)
                    {
                        IgnoreProperties.Remove(ignoreProperty);
                    }
                }
            }
#endif
        }
Ejemplo n.º 4
0
        public CustomerInvoice()
        {
            DtoFields.Add("documentDueDate", new DtoValue(DateTime.Today.AddDays(14)));
            DtoFields.Add("cashDiscountDate", new DtoValue(DateTime.Today));

            IgnoreProperties.Add(nameof(this.number));
            IgnoreProperties.Add(nameof(this.referenceNumber));
        }
Ejemplo n.º 5
0
 public Location(string baccountId, string locationId)
 {
     this.baccount        = new Baccount();
     this.baccount.number = baccountId;
     this.locationId      = locationId;
     IgnoreProperties.Add(nameof(baccount));
     IgnoreProperties.Add("baccountId");
     IgnoreProperties.Add(nameof(locationId));
 }
Ejemplo n.º 6
0
 internal override void PrepareForUpdate()
 {
     foreach (var salesOrderLine in lines)
     {
         salesOrderLine.operation = ApiOperation.Update;
     }
     IgnoreProperties.Add(nameof(customer));
     if (lines.Count > 0)
     {
         IgnoreProperties.Add(nameof(currency));
     }
 }
Ejemplo n.º 7
0
 public Location(string baccountId, string locationId, bool standAloneLocation = false)
 {
     this.baccount        = new Baccount();
     this.baccount.number = baccountId;
     this.locationId      = locationId;
     IgnoreProperties.Add(nameof(baccount));
     if (!standAloneLocation)
     {
         IgnoreProperties.Add("baccountId");
         IgnoreProperties.Add(nameof(locationId));
     }
 }
        private void HandleValidationInternal(object sender, object message)
        {
            var validationMessage = message as AsyncValidationMessage;

            if (validationMessage != null)
            {
                RaiseErrorsChanged(new DataErrorsChangedEventArgs(validationMessage.PropertyName));
                OnHandleAsyncValidationMessage(sender, validationMessage);
                return;
            }
            var errorsMessage = message as DataErrorsChangedMessage;

            if (errorsMessage == null)
            {
                return;
            }
            OnErrorsChanged(sender, errorsMessage);
#if NONOTIFYDATAERROR
            //To update property error in UI.
            ThreadManager.InvokeOnUiThreadAsync(() =>
            {
                string ignoreProperty = errorsMessage.PropertyName ?? string.Empty;
                lock (_locker)
                {
                    //Disable validation to prevent cycle
                    var contains = IgnoreProperties.Contains(ignoreProperty);
                    if (!contains)
                    {
                        IgnoreProperties.Add(ignoreProperty);
                    }
                    try
                    {
                        OnPropertyChanged(errorsMessage.PropertyName, ExecutionMode.None);
                    }
                    finally
                    {
                        if (!contains)
                        {
                            IgnoreProperties.Remove(ignoreProperty);
                        }
                    }
                }
            });
#endif
        }
Ejemplo n.º 9
0
 public SupplierInvoice()
 {
     IgnoreProperties.Add(nameof(referenceNumber));
 }
Ejemplo n.º 10
0
 protected void AddIgnoreProperty <TModel>(Func <Expression <Func <TModel, object> > > getProperty)
 {
     IgnoreProperties.Add(getProperty.GetMemberName());
 }
Ejemplo n.º 11
0
 public Project(string projectNumber)
 {
     projectID = projectNumber;
     IgnoreProperties.Add(nameof(this.internalID));
 }
Ejemplo n.º 12
0
 public Customer()
 {
     IgnoreProperties.Add(nameof(this.number));
 }
Ejemplo n.º 13
0
 public SalesOrder()
 {
     IgnoreProperties.Add(nameof(orderNo));
     IgnoreProperties.Add("orderNumber");
     RequiredFields.Add(nameof(orderType), new DtoValue("SO"));
 }
Ejemplo n.º 14
0
 public Project()
 {
     IgnoreProperties.Add(nameof(this.projectID));
     IgnoreProperties.Add(nameof(this.internalID));
 }
Ejemplo n.º 15
0
 public Supplier()
 {
     IgnoreProperties.Add(nameof(this.number));
 }
Ejemplo n.º 16
0
 public CustomerInvoice()
 {
     IgnoreProperties.Add(nameof(referenceNumber));
 }
Ejemplo n.º 17
0
 public InsertSqlOptions(TableInfo info) : base(info)
 {
     IdentityColumn = info.GetIdentityColumnName();
     info.Columns.Where(d => d.IgnoreWrite).ForEach(d => IgnoreProperties.Add(d.Name));
 }
        public void GameFilter()
        {
            //AreaRegistration.RegisterAllAreas();

            //WebApiConfig.Register(GlobalConfiguration.Configuration);
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            //AuthConfig.RegisterAuth();
            //Database.SetInitializer<SelectumContext>(new SelectumInitializer());
            Database.SetInitializer<SelectumContext>(null);

            int id = 0;

            // expecteds
            string messageToUser = "******";
            var resultsViewModel = new ResultsByGame();
            resultsViewModel.Results.Add(new ResultByGame());

            ResultsByGameController controller = new ResultsByGameController();
            ViewResult result = controller.GameFilter(id) as ViewResult;

            Assert.AreEqual(messageToUser, result.ViewBag.MessageToUser);

            IgnoreProperties ignoreProps = new IgnoreProperties();
            ignoreProps.Add(new PropertyComparisonExclusion(typeof(List<string>), "Capacity"));
            UnitTestingHelper.AssertPublicPropertiesEqual(resultsViewModel, result.Model, ignoreProps);
        }
Ejemplo n.º 19
0
 public Inventory()
 {
     IgnoreProperties.Add(nameof(inventoryNumber));
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Adds a property name to the <see cref="ValidatableViewModel.IgnoreProperties" />.
 /// </summary>
 protected void AddIgnoreProperty <TValue>(Expression <Func <T, TValue> > getProperty)
 {
     IgnoreProperties.Add(getProperty.GetMemberInfo().Name);
 }
Ejemplo n.º 21
0
 public CustomerCreditNote()
 {
     IgnoreProperties.Add(nameof(this.referenceNumber));
 }
Ejemplo n.º 22
0
 public CustomerInvoice()
 {
     IgnoreProperties.Add(nameof(this.referenceNumber));
     IgnoreProperties.Add(nameof(this.exchangeRate));
 }
Ejemplo n.º 23
0
 public PurchaseOrder()
 {
     IgnoreProperties.Add(nameof(orderNbr));
     IgnoreProperties.Add("orderNbr");
 }