Ejemplo n.º 1
0
        for_measure_dimension_defining_new_coeffiecient_unit_should_throw_exception_when_formula_has_invliad_parenthesis_formart()
        {
            var basicUnit = new BasicMeasureUnitTestBuilder().BuildArg();

            var formulatedUnitBuilder = new FormulatedMeasureUnitTestBuilder();
            var farenheit             = formulatedUnitBuilder
                                        .WithConvertFormulaToBasicUnit("23 + ( (a+3)")
                                        .BuildArg();

            var dimension = new MeasureDimensionTestBuilder()
                            .WithBasicMeasureUnitArg(basicUnit)
                            .Build();

            Action action = () => dimension.DefineFormulatedUnit(farenheit);

            Check.ThatCode(action).Throws <ParenthesisAreNotBalanced>();
        }
Ejemplo n.º 2
0
        public void for_measure_dimension_new_formulated_units_should_be_defined_properly()
        {
            var celcius = new BasicMeasureUnitTestBuilder()
                          .WithSymbol(new Symbol(MeasureUnitSymbolTestData.CelciusUnitSymbol))
                          .WithTitle("سلسیوس")
                          .BuildArg();

            var formulatedUnitBuilder = new FormulatedMeasureUnitTestBuilder();
            var farenheit             = formulatedUnitBuilder
                                        .WithSymbol(new Symbol(MeasureUnitSymbolTestData.FarenheitUnitSymbol))
                                        .WithTitle("فارنهایت")
                                        .WithConvertFormulaToBasicUnit("my formula")
                                        .WitCconvertFormulaFromBasicUnit("my formula")
                                        .BuildArg();

            var dimension = new MeasureDimensionTestBuilder()
                            .WithBasicMeasureUnitArg(celcius)
                            .Build();

            dimension.DefineFormulatedUnit(farenheit);

            Check.That(dimension.MeasureUnits.First(c => c.Id == farenheit.Id))
            .Considering().All.Properties.IsEqualTo(farenheit);
        }