public WordMatrixService()
 {
     _rulesRepository  = new RulesRepository();
     _valuesRepository = new ValuesRepository();
     _wordsRepository  = new WordsRepository();
     _cypherRepository = new CypherRepository();
 }
Example #2
0
        public void ReturnsSpecificValues()
        {
            var repository = new ValuesRepository();

            var value = repository.GetById(0);

            Assert.AreEqual("value", value);
        }
Example #3
0
        public void ReturnsAllValues()
        {
            var repository = new ValuesRepository();

            var values = repository.GetAll();

            Assert.AreEqual(2, values.Count());
        }
Example #4
0
        //===============================
        //private readonly ValuesRepository _repository;

        //public ValuesController(ValuesRepository repository)
        //{
        //    this._repository = repository ?? throw new ArgumentNullException(nameof(repository));
        //}
        //===============================

        public ValuesController(IDataProtectionProvider protectionProvider, HashService hashService, ValuesRepository repository)
        {
            _protector   = protectionProvider.CreateProtector("valor_unico_y_quizas_secreto");
            _hashService = hashService;

            //==================PROCEDIMIENTO ALMACENADO
            _repository = repository ?? throw new ArgumentNullException(nameof(repository));
        }
Example #5
0
        public void GetValueBadId()
        {
            var _repo = new ValuesRepository();

            var _results = _repo.GetOne(Guid.NewGuid());

            Assert.IsNull(_results);
        }
Example #6
0
        public void SetUp()
        {
            _dbContext = new Mock <ValuesContext>();
            _dbContext.Setup(context => context.Values.Add(It.IsAny <ValueRecord>()));

            var subject = new ValuesRepository(_dbContext.Object);

            subject.Add(234);
        }
Example #7
0
        public void Get()
        {
            var repo = new ValuesRepository();

            var id = 10;

            for (var i = 0; i < id; i++)
            {
                var val = repo.GetNext();
                EventSourceAttribute.StreamWrapper.Write(val, "value");
            }
        }
Example #8
0
            public async Task Pass_Data_With_Put_Request()
            {
                const string expectedName = "John Smith";
                var          id           = Guid.NewGuid();
                var          user         = new { name = expectedName };

                await Api
                .When()
                .Post($"putNameToValues_PUT/{id}", user)
                .Then()
                .Status(HttpStatusCode.OK);

                Assert.Equal(expectedName, ValuesRepository.Get(id));
            }
Example #9
0
        public void CreateNewValue()
        {
            var _repo = new ValuesRepository();

            var _newValue = new ValueModel();

            _newValue.Name = "Joe";
            _newValue.Id   = Guid.NewGuid();

            _repo.Save(_newValue);

            var _result = _repo.GetOne(_newValue.Id);

            Assert.IsNotNull(_result);
        }
Example #10
0
            public async Task Verify_Response_From_Delete_Request()
            {
                var id = AddTestValue("test-value");

                Assert.True(ValuesRepository.HasValue(id));

                await
                Api
                .When()
                .Delete($"deleteValueById/{id}")
                .Then()
                .Status(HttpStatusCode.OK);

                Assert.False(ValuesRepository.HasValue(id));
            }
Example #11
0
        /// <summary>
        /// Implementation of the IOhmValueCalculator interface for calculating the Ohm value of a resistor based on the band colors.
        /// </summary>
        /// <param name="bandAColor"></param>
        /// <param name="bandBColor"></param>
        /// <param name="bandCColor"></param>
        /// <param name="bandDColor"></param>
        /// <returns></returns>
        public int CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor)
        {
            ValuesRepository valuesRepository = new ValuesRepository();
            int result = 0;

            Dictionary <string, int>   a = valuesRepository.a;
            Dictionary <string, int>   b = valuesRepository.b;
            Dictionary <string, int>   c = valuesRepository.c;
            Dictionary <string, float> d = valuesRepository.d;

            var calc = (a[bandAColor] * 10 + b[bandBColor]) * Math.Pow(10, c[bandCColor]) * (1 + d[bandDColor]);

            result = Convert.ToInt32(calc);

            return(result);
        }
Example #12
0
        ///
        public HomeController()
        {
            valuesRepository = new ValuesRepository();
            ohmViewModel     = new OhmViewModel
            {
                BandA = new List <SelectListItem>(),
                BandB = new List <SelectListItem>(),
                BandC = new List <SelectListItem>(),
                BandD = new List <SelectListItem>()
            };

            ohmViewModel.BandA = valuesRepository.RetrieveBandValues("A");
            ohmViewModel.BandB = valuesRepository.RetrieveBandValues("B");
            ohmViewModel.BandC = valuesRepository.RetrieveBandValues("C");
            ohmViewModel.BandD = valuesRepository.RetrieveBandValues("D");
        }
Example #13
0
 public ValuesController(ValuesRepository _repository)
 {
     repository = _repository;
 }
Example #14
0
 public ValuesController(ValuesRepository repository)
 {
     _repository = repository;
 }
Example #15
0
 public ValuesController(ValuesRepository repository)
 {
     this._repository = repository ?? throw new ArgumentNullException(nameof(repository));
 }
Example #16
0
 public ValuesController(ValuesRepository vr)
 {
     _vr = vr;
 }
Example #17
0
 public ValuesController()
 {
     _valuesRepository = new ValuesRepository();
     _logger           = LogManager.GetLogger(GetType());
 }