예제 #1
0
        public void BendingResistanceCalculationTest_Example1_9_Success()
        {
            var parameters = _testEngine.ParameterRepository.GetAllParametersForScriptAsync(ID).Result.ToList();

            var parametersResource       = _testEngine.Mapper.Map <List <Parameter>, List <ParameterResource> >(parameters);
            var parametersForCalculation = new Dictionary <string, ParameterResource>(
                parametersResource.Where(p => (p.Context & ParameterOptions.Editable) != 0 &&
                                         (p.Context & ParameterOptions.Visible) != 0)
                .ToDictionary(p => p.Name, p => p));

            parametersForCalculation["f_y_"].Value = "355";
            parametersForCalculation["h"].Value    = "300";
            parametersForCalculation["b"].Value    = "150";
            parametersForCalculation["t_f_"].Value = "10.7";
            parametersForCalculation["t_w_"].Value = "7.1";
            parametersForCalculation["Type"].Value = "Rolled";
            parametersForCalculation["r"].Value    = "15";

            List <ParameterResource> results = _testEngine.Calculate(ID, parametersForCalculation.Select(p => p.Value).ToList());

            Assert.That(Convert.ToDouble(results.FirstOrDefault(r => r.Name == "W_pl,y_").Value),
                        Is.EqualTo(628).Within(1));
            Assert.That(Convert.ToDouble(results.FirstOrDefault(r => r.Name == "M_c,Rd_").Value),
                        Is.EqualTo(223).Within(1));
        }
예제 #2
0
        public void SteelTensionCalculationTest_RandomExamples_Success()
        {
            var parameters = _testEngine.ParameterRepository.GetAllParametersForScriptAsync(ID).Result.ToList();

            var parametersResource       = _testEngine.Mapper.Map <List <Parameter>, List <ParameterResource> >(parameters);
            var parametersForCalculation = new Dictionary <string, ParameterResource>(
                parametersResource.Where(p => (p.Context & ParameterOptions.Editable) != 0 &&
                                         (p.Context & ParameterOptions.Visible) != 0)
                .ToDictionary(p => p.Name, p => p));

            parametersForCalculation["A"].Value     = _testEngine.GetBigRandom();
            parametersForCalculation["N_Ed_"].Value = _testEngine.GetBigRandom();
            parametersForCalculation["f_y_"].Value  = _testEngine.GetBigRandom();

            Assert.DoesNotThrow(() => _testEngine.Calculate(ID, parametersForCalculation.Select(p => p.Value).ToList()),
                                String.Join(", ", parametersForCalculation.Select(p => $"{p.Value.Name}={p.Value.Value}")));
        }
        public void CompressiveStrengthOfConcreteAtAnAgeTests_RandomExamples_Success()
        {
            var parameters = _testEngine.ParameterRepository.GetAllParametersForScriptAsync(ID).Result.ToList();

            var parametersResource       = _testEngine.Mapper.Map <List <Parameter>, List <ParameterResource> >(parameters);
            var parametersForCalculation = new Dictionary <string, ParameterResource>(
                parametersResource.Where(p => (p.Context & ParameterOptions.Editable) != 0 &&
                                         (p.Context & ParameterOptions.Visible) != 0)
                .ToDictionary(p => p.Name, p => p));

            parametersForCalculation["f_ck_"].Value        = _testEngine.GetBigRandom();
            parametersForCalculation["f_cm_"].Value        = _testEngine.GetBigRandom();
            parametersForCalculation["cement_type_"].Value = _testEngine.GetValueFromRange(
                parametersForCalculation["cement_type_"].ValueOptions
                .Select(vo => vo.Value)
                .ToArray());
            parametersForCalculation["t"].Value = _testEngine.GetBigRandom(min: 3);

            Assert.DoesNotThrow(() => _testEngine.Calculate(ID, parametersForCalculation.Select(p => p.Value).ToList()),
                                String.Join(", ", parametersForCalculation.Select(p => $"{p.Value.Name}={p.Value.Value}")));
        }