Example #1
0
 public void Test1()
 {
     var repo                = new ValueRepository();
     var service             = new ValueService(repo);
     var controller          = new ValuesController(service);
     var controllerActivator = new ManualControllerActivator(new [] { controller });
 }
        public async Task GetStoriesTest()
        {
            ValueService service = new ValueService();
            List <Story> stories = await service.GetStories(100, 1, null);

            Assert.AreEqual(100, stories.Count);
        }
        public void Add(Value value)
        {
            var model = ValueService.Add();

            model.Item = value;
            Add(model);
        }
Example #4
0
 public DefaultController(
     IAuthorizationService authorizationService,
     ValueService valueService)
 {
     this.authorizationService = authorizationService;
     this.valueService         = valueService;
 }
        public void ReturnMessageContainingSuccessful()
        {
            var service = new ValueService();

            var result = service.GetValueFromApi();

            result.ShouldContain("successful");
        }
Example #6
0
        public void GetValues_ListAllValues()
        {
            ValueService valueService = new ValueService();

            var result = valueService.GetValues();

            Assert.NotEmpty(result);
        }
        public async Task GetStoryIdsTest()
        {
            ValueService service = new ValueService();

            var result = await service.GetStories(100, 1, null);

            Assert.IsNotNull(result);
        }
        public void Edit(int id)
        {
            var model  = ValueService.Edit(id);
            var window = new AddEditValue(this);

            window.Render(model);
            window.ShowDialog();
        }
        public async Task GetStoryFromIdTest()
        {
            //24643830
            var          id      = 24643830;
            ValueService service = new ValueService();
            Story        story   = await service.GetStoryFromId(id);

            Assert.IsNotNull(story);
        }
Example #10
0
 public HomeController()
 {
     this._alarmService   = new AlarmService();
     this._areaService    = new AreaService();
     this._stationService = new StationService();
     this._deviceService  = new DeviceService();
     this._pointService   = new PointService();
     this._orderService   = new OrderService();
     this._valueService   = new ValueService();
     this._excelManager   = new ExcelManager();
 }
 public void Save(ValueModel model)
 {
     ValueService.Save(model);
     MainViewModel.ValueOrEventChangedUpdateOpenFiles();
     if (View == null)
     {
         return;
     }
     RenderDocument();
     View.UpdateView(model);
 }
Example #12
0
        public DeleteValueById()
        {
            _loggerAdapterMock   = new Mock <ILoggerAdapter <ValueService> > (MockBehavior.Strict);
            _valueRepositoryMock = new Mock <IValueRepository> (MockBehavior.Strict);

            _mockList = new List <Mock> {
                _loggerAdapterMock,
                _valueRepositoryMock
            };
            _sut = new ValueService(_loggerAdapterMock.Object, _valueRepositoryMock.Object);
        }
        public void Delete(int id)
        {
            var model = ValueService.Delete(id);

            MainViewModel.ValueOrEventChangedUpdateOpenFiles();
            if (View == null)
            {
                return;
            }
            RenderDocument();
            View.UpdateView(model);
        }
Example #14
0
 public AppClient()
 {
     this._userService    = new UserService();
     this._roleService    = new RoleService();
     this._alarmService   = new AlarmService();
     this._areaService    = new AreaService();
     this._stationService = new StationService();
     this._deviceService  = new DeviceService();
     this._pointService   = new PointService();
     this._orderService   = new OrderService();
     this._valueService   = new ValueService();
     this._cacheManager   = new CacheManager();
 }
        public static async Task <string> Run(HttpRequestMessage req, IAsyncCollector <string> outputQueues, TraceWriter log)
        {
            ValueService valueService = new ValueService();

            log.Info("C# HTTP trigger function processed a request.");

            var body = await req.Content.ReadAsStringAsync().ConfigureAwait(false);

            var id = req.GetQueryNameValuePairs()
                     .FirstOrDefault(q => string.Compare(q.Key, "id", true) == 0).Value;;
            var result = valueService.GetValue(int.Parse(id));

            // Make sure it returns HTTP Status Code of 202 (Accepted).
            return(await result);
        }
Example #16
0
        public IActionResult Index()
        {
            ValueService  valueService = new ValueService();
            List <string> stringvalues = valueService.GetValues();

            List <Value> values = new List <Value>();

            for (int i = 0; i < stringvalues.Count; i++)
            {
                Value  value    = new Value();
                string variable = stringvalues.ElementAt <string>(i);
                value.StringValue = variable;
                values.Add(value);
            }

            return(View(values));
        }
Example #17
0
        /// <summary>
        /// Montre les champs et les valeurs d'une table pour un utilisateur séléctionné
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult TableIndex(int id)
        {
            var indexTable = new IndexTableViewModel()
            {
                NameTable   = TableService.GetTableById(id).Nom,
                ListeChamps = ChampsService.GetChampsFromTable(id).Select(p => new ChampViewModel
                {
                    Id  = p.Id,
                    Nom = p.Name,
                }).ToList(),
                ListeLiaison = LiaisonValueService.GetAllLiaison().Where(p => p.IdTable == id).Select(w => new LiaisonTableIndexViewModel
                {
                    Id         = w.Id,
                    ListeValue = ValueService.GetValueFromLiaison(w.Id).Select(a => new ValuesViewModel
                    {
                        Nom      = a.Name,
                        IdChamps = a.ChampsId
                    }).ToList(),
                }).ToList(),
            };

            return(View(indexTable));
        }
        public Data Get()
        {
            string filter = "";
            string sort   = "";

            if (Request.QueryString.Value.ToString().Length > 1)
            {
                var queryDictionary = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(Request.QueryString.Value);
                foreach (var kvp in queryDictionary)
                {
                    if (kvp.Key.ToString().Equals("filter"))
                    {
                        filter = kvp.Value.ToString().ToLower();
                    }
                    if (kvp.Key.ToString().Equals("sort"))
                    {
                        sort = kvp.Value.ToString().ToLower();
                    }
                }
            }
            ValueService valueService = new ValueService();

            return(valueService.GetValues(filter, sort));
        }
Example #19
0
 public ValueTest()
 {
     _valueServices = new ValueService(null);
 }
Example #20
0
 public InServicesTagHelper(ValueService value)
 {
     _value = value;
 }
 public ComponentFromServicesViewComponent(ValueService value)
 {
     _value = value;
 }
 public ComponentFromServicesViewComponent(ValueService value)
 {
     _value = value;
 }
 public void Add()
 {
     Add(ValueService.Add());
 }
Example #24
0
        private static void BuildDocumentMapValues(FileData file)
        {
            var stopwatch = new Stopwatch($"Build DocumentMap Values for \"{file.Path}\"");

            try
            {
                if (file == null)
                {
                    return;
                }

                var text  = string.Empty;
                var lines =
                    file.RawTextString.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();

                Parallel.ForEach(file.FileValues.Where(item => item.DocumentMap), (item) =>
                {
                    if (lines.Count >= item.iLine - 1)
                    {
                        text = lines[item.iLine];
                    }

                    var value = ValueService.GetValueById(item.ValueId);
                    // Why would value be null, do we have another list that has an old reference that is no longer valid.
                    // I deleted a value and then GetValueByid returned a null value, thus I added this code
                    // TODO: I need to research why - Sara
                    if (value == null)
                    {
                        return;
                    }

                    var filtered = value.DocumentMapFiltered;

                    var de = new DocumentEntry
                    {
                        Name     = item.Name,
                        iLine    = item.iLine,
                        Value    = item.Value,
                        Type     = DocumentMapType.Value,
                        Id       = item.ValueId,
                        Level    = item.Level,
                        Text     = text,
                        Filtered = filtered,
                        Sort     = item.Sort
                    };

                    lock (file.DocumentMap)
                        file.DocumentMap.Add(de);
                });
            }
            catch (Exception ex)
            {
                // We are updating the data in the background
                // Once the update is complete the system will trigger for this view to Render - Sara
                if (ex is InvalidOperationException && ex.Message == "Collection was modified; enumeration operation may not execute.")
                {
                    // Do Nothing
                }
                else
                {
                    throw;
                }
            }
            stopwatch.Stop(0);
        }
Example #25
0
        //private readonly IOptions<MyOptions> _monitorOptions;

        public MyService6Controller(IOptionsSnapshot <MyOptions> settings, ValueService service)
        {
            _settings = settings;
            //_monitorOptions = optionsAccessor;
            _service = service;
        }
Example #26
0
 public ValueController(ValueService valueService) => _valueService = valueService;
Example #27
0
 public InServicesTagHelper(ValueService value)
 {
     _value = value;
 }
 public override ValueCacheData GetModel()
 {
     return(ValueService.GetModel());
 }
Example #29
0
 public ValuesController(ValueService valueService)
 {
     _valueService = valueService;
 }
 public ValuesController()
 {
     valueService = new ValueService();
 }
Example #31
0
 public ValueController(ValueService valueServices)
 {
     _valueServices = valueServices;
 }