Exemple #1
0
        public void Update_ManagementProperties()
        {
            // Arrange
            IManagementPropertiesDataMapper dataMapper = new ManagementPropertiesJsonDataMapper(_managementPropertiesPath);
            ManagementProperties            properties = new ManagementProperties
            {
                OlcPrice = 150,
                PeriodAfterLastCourseEmployableInDays = 2,
                PeriodBeforeStartNotifiable           = 4,
                PeriodEducationPlanInDays             = 100,
                Footer = "new footer"
            };

            // Act
            dataMapper.Update(properties);

            // Assert
            var propertiesResult = dataMapper.FindManagementProperties();

            Assert.AreEqual(150, propertiesResult.OlcPrice);
            Assert.AreEqual(2, propertiesResult.PeriodAfterLastCourseEmployableInDays);
            Assert.AreEqual(4, propertiesResult.PeriodBeforeStartNotifiable);
            Assert.AreEqual(100, propertiesResult.PeriodEducationPlanInDays);
            Assert.AreEqual("new footer", propertiesResult.Footer);
        }
 // POST: api/ManagementProperties
 public void Post(ManagementProperties properties)
 {
     if (ModelState.IsValid)
     {
         _managementPropertiesManager.Update(properties);
     }
 }
Exemple #3
0
        private void WriteAllPropertiesToFile(ManagementProperties properties)
        {
            var convertedJson = JsonConvert.SerializeObject(properties, Formatting.Indented);

            if (File.Exists(_path))
            {
                File.WriteAllText(_path, convertedJson);
            }
            else
            {
                string errorMessage = "File to write properties not found";
                _logger.Error(errorMessage);
                throw new FileNotFoundException(errorMessage);
            }
        }
Exemple #4
0
        public void Update_WithNotExistingPath_ManagementProperties_ExceptionThrowed()
        {
            // Arrange
            IManagementPropertiesDataMapper dataMapper = new ManagementPropertiesJsonDataMapper("noPath");
            ManagementProperties            properties = new ManagementProperties
            {
                OlcPrice = 150,
                PeriodAfterLastCourseEmployableInDays = 2,
                PeriodBeforeStartNotifiable           = 4,
                PeriodEducationPlanInDays             = 100,
                Footer        = "new footer",
                StaffDiscount = 80,
            };

            // Act
            dataMapper.Update(properties);

            // Assert FileNotFoundException
        }
Exemple #5
0
 public void Update(ManagementProperties properties)
 {
     _logger.Debug("Update management properties");
     WriteAllPropertiesToFile(properties);
 }
 public void Update(ManagementProperties properties)
 {
     _managementPropertiesDataMapper.Update(properties);
 }