public void ConvertToBinaryTest()
 {
     Assert.AreEqual("110100010001.110001", Convertions.ConvertDecimalToBinaryString(input: 3345.7680098M, precisionForBinary: 6, culture: new CultureInfo("ja-JP")));
     Assert.AreEqual("-10100100010100,11", Convertions.ConvertDecimalToBinaryString(input: -10516.7888M, precisionForBinary: 4, culture: new CultureInfo("fr-FR")));
     Assert.AreEqual("10000000000000000000000000000000", Convertions.ConvertDecimalToBinaryString(input: 2147483648M, precisionForBinary: 5, culture: new CultureInfo("uk-UA")));
     Assert.AreEqual("0.000110011", Convertions.ConvertDecimalToBinaryString(input: 0.1M, precisionForBinary: 10, culture: new CultureInfo("en-US")));
 }
示例#2
0
        public static void addToCalculateResulte()
        {
            Contract con3;

            foreach (var item in contractUsed)
            {
                if (item.Key.isContract == true)
                {
                    con3 = contracts.Where(u => u.id == item.Key.idContractOrTravel).FirstOrDefault();
                    if (con3 != null)
                    {
                        CalculateResulte c = new CalculateResulte(travelsToCurrentContractDTO, type == "freeDay" ? true : false, con3.Description, item.Key.idContractOrTravel, item.Key.price);
                        if (!calculateResultes.Contains(c))
                        {
                            calculateResultes.Add(c);
                        }
                    }
                }
                else
                {
                    if (type == "freeDay")
                    {
                        Travel tr = db.Travels.Where(q => q.id == item.Key.idContractOrTravel).FirstOrDefault();
                        if (tr != null)
                        {
                            TravelsDTO trDTO = Convertions.Convertion(tr);
                            calculateResultes[0].TravelToCon.Add(trDTO);
                            calculateResultes[0].price += item.Key.price;
                        }
                    }
                }
            }
        }
示例#3
0
        private void Question_13_Load(object sender, EventArgs e)
        {
            var dbConnection = DB.Instance();

            dbConnection.DatabaseName = "respuestas";
            if (!dbConnection.IsConnect())
            {
                MessageBox.Show("Hay un error con la base de Datos", "Información");
            }

            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT xiii.valor, COUNT( * ) as cantidad FROM respuestas INNER JOIN xiii ON respuestas.XIII = xiii.clave GROUP BY XIII", dbConnection.Connection);
            DataTable        table   = new DataTable();

            adapter.Fill(dataSet1);

            table = dataSet1.Tables[0];

            List <Questions> list = Convertions.ConvertoToList(table);

            chartControl1.Series[0].DataSource         = list;
            chartControl1.Series[0].ArgumentDataMember = "valor";
            chartControl1.Series[0].ValueDataMembers.AddRange(new string[] { "cantidad" });

            chartControl1.Series[0].Label.TextPattern = "{V} ({VP:p0})";
            chartControl1.Series[0].LegendTextPattern = "{A}";
        }
示例#4
0
 public static List <UserDTO> GetUsersList(int id)
 {
     if (db.Users.FirstOrDefault(x => x.id == id).isManager)
     {
         return(Convertions.Convertion(db.Users.Where(y => !y.isManager || y.id == id).ToList()));
     }
     return(null);
 }
示例#5
0
        public static void StartCollector(CollectorPluginBase collector)
        {
            _collector = collector;

            CBridge.start_collector(
                CollectHandlerFn, LoadHandlerFn, UnloadHandlerFn, DefineHandlerFn,
                collector.Name, Convertions.ToSemanticVersion(collector.Version));
        }
示例#6
0
 public IActionResult Mean(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal mean = (Convertions.ConvertToDecimal(firstNumber) + Convertions.ConvertToDecimal(secondNumber)) / 2;
         return(Ok(mean.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
示例#7
0
 public IActionResult SquareRoot(string number)
 {
     if (number.IsNumeric())
     {
         var squareRoot = Math.Sqrt((double)Convertions.ConvertToDecimal(number));
         return(Ok(squareRoot.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
示例#8
0
 public IActionResult Division(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal division = Convertions.ConvertToDecimal(firstNumber) / Convertions.ConvertToDecimal(secondNumber);
         return(Ok(division.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
示例#9
0
 public IActionResult Sum(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal sum = Convertions.ConvertToDecimal(firstNumber) + Convertions.ConvertToDecimal(secondNumber);
         return(Ok(sum.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
示例#10
0
        private static void DisplayBinaryResult(decimal input, CultureInfo culture)
        {
            string binaryResult = Convertions.ConvertDecimalToBinaryString
                                      (input: input, precisionForBinary: PrecisionForBinaryResult, culture: culture);

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Write("binary: ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(binaryResult);
        }
示例#11
0
        public static UserDTO IfExsistRavKav(string ravKav, string pass)
        {
            User user = db.Users.ToList().FirstOrDefault(x => x.ravkavNum == ravKav && x.pass == pass);

            if (user != null)
            {
                return(Convertions.Convertion(user));
            }

            return(null);
        }
示例#12
0
        public async Task <ApiAssetPairHistoryRateModel> GetHistoryRate([FromRoute] string assetPairId,
                                                                        [FromBody] AssetPairRateHistoryRequest request)
        {
            var buyCandle = _feedCandlesRepository.GetCandleAsync(assetPairId, request.Period.ToDomainModel(),
                                                                  true, request.DateTime);

            var sellCandle = _feedCandlesRepository.GetCandleAsync(assetPairId, request.Period.ToDomainModel(),
                                                                   false, request.DateTime);

            return(Convertions.ToApiModel(assetPairId, await buyCandle, await sellCandle));
        }
示例#13
0
        private void fill()
        {
            dataSet1.Reset();
            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM respuestas", dbConnection.Connection);
            DataTable        table   = new DataTable();

            adapter.Fill(dataSet1);

            table = dataSet1.Tables[0];

            listRespuestas = Convertions.ConvertoToListResp(table);
        }
示例#14
0
        public static List <TravelsDTO> getTravels(int id)
        {
            int               month     = 01;
            int               year      = 2021;
            List <Travel>     travel    = db.Travels.Where(l => l.userID == id && l.date.Month == month && l.date.Year == year).ToList();
            List <TravelsDTO> travelDTO = new List <TravelsDTO>();

            foreach (var item in travel)
            {
                travelDTO.Add(Convertions.Convertion(item));
            }
            return(travelDTO);
        }
示例#15
0
        public async Task <IEnumerable <ForecastItem> > GetNextFiveDaysWeather(string cityName, Unit unit = Unit.Standard, Language language = Language.en)
        {
            var reqUrl   = _requestBuilder.GetForecastUri(cityName, unit, language);
            var forecast = await RestClient.GetAsync <WeatherForecast>(reqUrl);

            var list = forecast.List
                       .Select(forecastListItem => new ForecastItem
            {
                Date        = Convertions.UnixTimeStampToDateTime(forecastListItem.LastUpdate).ToString("dd/MM/yyyy"),
                Temperature = forecastListItem.Main.Temperature,
                Description = forecastListItem.Weather[0]?.Description
            });

            return(list.GroupBy(forecastItem => forecastItem.Date).Select(ForecastItem => ForecastItem.First()).ToArray());
        }
        public List <Record> insertRecords(List <Record> obj)
        {
            #region convert Record class to ApiParameters
            var parameters = Convertions.convertToApiParameters(obj, "insertRecords");
            #endregion

            #region convert result to Record
            var result = Convertions.convertToRecord(ZohoApi.APIMethod("Leads", "insertRecords", "", parameters), "insertRecords");


            #endregion


            return(result);
        }
示例#17
0
        internal static string ExecuteExpression(string input, CultureInfo culture)
        {
            string decimalResult = null;

            try
            {
                var myNode = CalculationParser.GrowNodeTree(input: input, culture: culture);

                if (myNode != null)
                {
                    decimal result = DisplayDecimalResult(node: myNode, culture: culture);
                    decimalResult = result.ToString($"n{PrecisionForDecimalResult}", culture);
                    decimalResult = decimalResult.TrimEnd('0').TrimEnd(Separator(culture: culture));

                    string binaryResult = Convertions.ConvertDecimalToBinaryString
                                              (input: result, precisionForBinary: PrecisionForBinaryResult, culture: culture);

                    DisplayBinaryResult(input: result, culture: culture);

                    Console.ForegroundColor = ConsoleColor.White;

                    Notify?.Invoke();
                    Notify = null;
                }
            }
            catch (CheckingException exception)
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Error: " + exception.Message);
            }
            catch (DivideByZeroException)
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Error: Divide by Zero");
            }
            catch (OverflowException)
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Error: Too large or too small value");
            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("Error: Calculation failed");
            }

            return(decimalResult);
        }
示例#18
0
        public static bool UpdateUser(UserDTO user)
        {
            User u = Convertions.Convertion(user);

            try
            {
                db.Users.Attach(u);
                db.Entry <User>(u).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
示例#19
0
        public static bool AddUser(UserDTO user)
        {
            db.sp_addUder_Insert(user.fName, user.lName, user.email, user.pass, user.ravkav, user.profileId);

            User u = Convertions.Convertion(user);

            try
            {
                db.Users.Add(u);
                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public IEnumerable <Record> getRecords(string obj)
        {
            //#region convert Record class to ApiParameters
            //var parameters = Convertions.convertToApiaparameters(obj);
            //#endregion
            var apiparams = Convertions.convertToApiParameters(obj);

            #region convert result to Record
            List <ApiParameters> parameterList = new List <ApiParameters>();
            parameterList.Add(apiparams);
            //"<Leads><row no='1'>   <FL val='LEADID'>2000000022020</FL>  <FL val='SMOWNERID'>2000000018005</FL>  <FL val='Lead Owner'>John</FL>   <FL val='Company'>Zillium</FL>    <FL val='First Name'>Scott</FL>   <FL val='Last Name'>James</FL>      <FL val='No of Employees'>10</FL> <FL val='Annual Revenue'>1000.0</FL> <FL val='SMCREATORID'>2000000016908</FL>  <FL val='Created By'>John</FL>  <FL val='Created Time'>2010-03-16 10:04:52</FL><FL val='Modified Time'>2010-03-16 10:04:52</FL> </row>  </Leads>"
            var result = Convertions.convertToRecord(ZohoApi.APIMethod("Leads", "getRecords", "", parameterList), "getRecords");

            #endregion


            return(result);
        }
示例#21
0
        /// <summary>
        /// Constructor Board sets default values and prepares console for
        /// unicode
        /// </summary>
        public Board()
        {
            checker     = new BoardChecker();
            convertions = new Convertions();
            // Prepare for unicode encoding
            Render.SetConsoleEncoding();

            // Getting the player symbols (ghost symbols from each player)
            ghostSymsP1 = new Symbols[3]
            {
                Symbols.ghosts1P1, Symbols.ghosts2P1, Symbols.ghosts3P1
            };

            ghostSymsP2 = new Symbols[3]
            {
                Symbols.ghosts1P2, Symbols.ghosts2P2, Symbols.ghosts3P2
            };
        }
        public Record getRecordById(Record obj, string specific)
        {
            #region convert Record class to ApiParameters
            var parameters = Convertions.convertToApiParameters(obj);
            parameters.selected_attr = "(" + specific + ")";

            #endregion

            #region convert result to Record
            List <ApiParameters> parameterList = new List <ApiParameters>();
            parameterList.Add(parameters);



            var result = Convertions.convertToRecord(ZohoApi.APIMethod("Leads", "getRecordById", obj.Id.ToString(), parameterList), "getRecordById");
            #endregion
            var asd = result.FirstOrDefault();

            return(result.FirstOrDefault());
        }
示例#23
0
 public override void _Process(float delta)
 {
     Player.RemoveEnergy(0.1f * delta);
     if (Player.energy == 0)
     {
         canMove = false;
     }
     if (Input.IsActionJustPressed("mouse1"))
     {
         //Storage sp = (Storage)Building.prefabs[Building.Type.Storage].Instance();
         //sp.Place(pos);
         Vector2 pos  = GetGlobalMousePosition();
         Vector2 pos1 = Convertions.Location2World(pos);
         Vector2 pos2 = Convertions.Location2WorldFloor(pos);
         GD.Print("\nValuers brutes : ", pos);
         GD.Print("Valuers Converties (decimal) : ", pos1);
         GD.Print("Valuers Converties (entier) : ", pos2);
         Chunk c = World.GetChunk((int)pos2.x);
         c.AddBlock(Chunk.GetLocaleX((int)pos2.x), (int)pos2.y, Block.Type.Stone);
     }
 }
        public List <Record> updateRecords(Record obj)
        {
            #region convert Record class to ApiParameters
            List <Record> list = new List <Record>();
            list.Add(obj);
            var parameters = Convertions.convertToApiParameters(list, "updateRecords");
            #endregion

            #region convert result to Record
            List <ApiParameters> responseList = new List <ApiParameters>();

            responseList = parameters;
            //

            var result = Convertions.convertToRecord(ZohoApi.APIMethod("Leads", "updateRecords", obj.Id.ToString(), responseList), "updateRecords");


            #endregion


            return(result);
        }
示例#25
0
        private void SimpleButton1_Click(object sender, EventArgs e)
        {
            dataSet2.Reset();
            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM respuestas WHERE IV = '" + textBoxSearchCedula.Text + "'", dbConnection.Connection);
            DataTable        table   = new DataTable();

            adapter.Fill(dataSet2);

            table = dataSet2.Tables[0];

            if (table.Rows.Count == 0)
            {
                return;
            }


            List <Respuestas> listRespuestas2 = Convertions.ConvertoToListResp(table);

            //table.Columns.Remove("numero");
            table.Columns.Remove("III");
            table.Columns.Remove("V");
            table.Columns.Remove("VI");
            table.Columns.Remove("VII");
            table.Columns.Remove("VIII");
            table.Columns.Remove("IX");
            table.Columns.Remove("X");
            table.Columns.Remove("XI");
            table.Columns.Remove("XII");
            table.Columns.Remove("XIII");
            table.Columns.Remove("XIV");
            table.Columns.Remove("XV");
            table.Columns.Remove("XVI");
            table.Columns.Remove("XVII");

            gridControl1.DataSource = table;
        }
示例#26
0
 public static UserDTO UserDetails(int id)
 {
     return(Convertions.Convertion(db.Users.FirstOrDefault(x => x.id == id)));
 }
示例#27
0
        //find base contract
        //the rules of base contract are:
        //contract who as the area of current travel
        //and this contract is cheapest cheapest
        public static void ContractBase(int id)
        {
            //contractUsed = new Dictionary<ContractInformation, List<Area>>();
            int contractTemp = -1;
            //Dictionary of used travels
            var    profile         = db.Profiles.Where(b => b.Users.Any(c => c.id == id)).FirstOrDefault();
            double profileDiscount = 0;

            if (profile != null)
            {
                profileDiscount = Convert.ToDouble(profile.discount);
            }
            double         price = 0;
            List <Travel>  travelsToCurrentContract;
            AreaToContract areaToCurrentContract;

            //Go over the travel list for the user
            for (int i = 0; i < travelsByDate.Count; i++)
            {
                if (travelUsed.ContainsKey(travelsByDate[i]))
                {
                    continue;
                }
                price = 0;
                //Finding the right and cheapest contract

                areaToCurrentContract = travelsByDate[i].Area.AreaToContracts.
                                        OrderBy(x => (type == "freeDay" ? x.Contract.freeDay : x.Contract.freeMounth)).FirstOrDefault();

                if (areaToCurrentContract != null)
                {
                    currentContract = areaToCurrentContract.Contract;
                }
                if (currentContract.id == contractTemp)
                {
                    continue;
                }
                contractTemp = currentContract.id;
                //Pulling out all travel appropriate to the contract
                travelsToCurrentContract = travelsByDate.Where(x => x.Area.AreaToContracts.Any(m => m.contractID == currentContract.id)).ToList();
                foreach (var item in travelsToCurrentContract)
                {
                    //Check if some of the travels have already been realized in other contracts, if not sum them price
                    if (!travelUsed.ContainsKey(item))
                    {
                        price += item.price;
                    }
                }
                if ((type == "freeDay" ? currentContract.freeDay : currentContract.freeMounth) <= price * profileDiscount)

                {
                    areaToCurrentContractTemp   = new List <Area>();
                    travelsToCurrentContractDTO = new List <TravelsDTO>();
                    //Add the travels to the travelUsed that for them a contract has been found
                    foreach (var item in travelsToCurrentContract)
                    {
                        if (!travelUsed.ContainsKey(item))
                        {
                            areaToCurrentContractTemp.Add(item.Area);
                            travelUsed.Add(item, currentContract.id);
                            travelsToCurrentContractDTO.Add(Convertions.Convertion(item));
                        }
                    }
                    //add the current contract to dictionary contractUsed
                    contractUsed.Add(new ContractInformation(currentContract.id,
                                                             (type == "freeDay" ? currentContract.freeDay : currentContract.freeMounth), true, travelsToCurrentContractDTO), areaToCurrentContractTemp);
                }
            }

            //add signal travels to contract used dictionary
            foreach (var travel in travelsByDate)
            {
                if (!travelUsed.ContainsKey(travel))
                {
                    List <Area> listSignalArea = new List <Area>();
                    listSignalArea.Add(travel.Area);
                    contractUsed.Add(new ContractInformation(travel.id, travel.price, false), listSignalArea);
                }
            }
        }
示例#28
0
        public static void ContractExtention(int id)
        {
            Area areaToList = new Area();

            areaToCurrentContractTemp = new List <Area>();
            bool b = func(id);

            while (b)
            {
                ContractInformation con;

                for (int i = 0; i < contractUsed.Count(); i++)
                // foreach (var c in contractUsed)
                {
                    if (contracts.Select(x => x.AreaToContracts.Join(contractUsed.ElementAt(i).Value, AreaToCon => AreaToCon.areaID, itemArea => itemArea.id, (AreaToCon, itemArea) => new { AreaToCon, itemArea }).Where(y => y.AreaToCon.contractID == conid)).Any())
                    {//create list of areas thet include in the extation contract
                        for (int v = 0; v < contractUsed.ElementAt(i).Value.Count(); v++)
                        //  foreach (var area in contractUsed.ElementAt(i).Value)
                        {
                            areaToList = contractUsed.ElementAt(i).Value[v];
                            if (areaToList != null)
                            {
                                areaToCurrentContractTemp.Add(areaToList);
                            }
                        }
                        //adding a single travel that included in the extantion contract to travelUsed
                        if (contractUsed.ElementAt(i).Key.isContract == false)
                        {
                            var g = travelsById.Where(x => x.id == contractUsed.ElementAt(i).Key.idContractOrTravel).FirstOrDefault();
                            if (g != null)
                            {
                                g.fContractID    = conid;
                                g.contractType   = type == "freeDay" ? true : false;
                                g.fFinalAmountID = finalAmount.id;
                                travelUsed.Add(g, conid);
                            }

                            //remove contracts and single travels that in the the extantion contract
                            contractUsed.Remove(contractUsed.ElementAt(i));
                        }
                    }
                    for (int j = 0; j < travelUsed.Count(); j++)
                    //foreach (var t in travelUsed)
                    { //changing the contract code for travels that were included in the contract that extaned
                        ContractInformation a = null;
                        Contract            g = new Contract();
                        if (travelUsed.ElementAt(j).Value == 0)
                        {
                            g = db.Contracts.Where(y => y.code == 0).FirstOrDefault();
                            if (g != null)
                            {
                                a = new ContractInformation(travelUsed.ElementAt(j).Value, (type == "freeDay" ? g.freeDay : g.freeMounth), true);
                            }
                        }
                        else
                        {
                            g = contracts.Where(m => m.id == travelUsed.ElementAt(j).Value).FirstOrDefault();
                            if (g != null)
                            {
                                a = new ContractInformation(travelUsed.ElementAt(j).Value, (type == "freeDay" ? g.freeDay : g.freeMounth), true);
                            }
                        }
                        if (!contractUsed.ContainsKey(a))
                        {
                            travelUsed[travelUsed.ElementAt(j).Key] = conid;
                        }
                        travelsToCurrentContractDTO.Add(Convertions.Convertion(travelUsed.ElementAt(j).Key));
                    }
                    //add extation contract to contractUsed
                    con = new ContractInformation(conid, (type == "freeDay" ? extntionContract.freeDay : extntionContract.freeMounth), true, travelsToCurrentContractDTO);
                    contractUsed.Add(con, areaToCurrentContractTemp);
                    b = func(id);
                }
                string day = travelsByDate[0].date.Day.ToString();
                //create a travel list for each contract
                foreach (var contract in contractUsed)
                {
                    if (contract.Key.isContract == false)
                    {
                        continue;
                    }
                    List <TravelsDTO> t = new List <TravelsDTO>();
                    if (type == "freeMounth")
                    {
                        foreach (var travel in travelUsed)
                        {
                            if (travel.Value == contract.Key.id)
                            {
                                t.Add(Convertions.Convertion(travel.Key));
                            }
                        }
                    }
                    else
                    {
                        foreach (var travel in travelUsed)
                        {
                            if (travel.Value == contract.Key.id && travel.Key.date.Day.ToString() == day)
                            {
                                t.Add(Convertions.Convertion(travel.Key));
                            }
                        }
                    }
                    CalculateResulte conresult;
                    var d = contracts.Where(x => x.id == contract.Key.id).FirstOrDefault().Description;
                    if (d != null)
                    {
                        conresult = new CalculateResulte(t, type == "freeDay" ? true : false, d, contract.Key.id, contract.Key.price);
                        calculateResultes.Add(conresult);
                    }
                }
            }
        }
示例#29
0
        internal CalcResult ExecuteExpression()
        {
            var decimalResult     = String.Empty;
            var binaryResult      = String.Empty;
            var hexadecimalResult = String.Empty;
            var decimalSeparator  = $"{Separator(culture: Culture)}";
            var message           = $"note, your decimal separator is a ' " + decimalSeparator + " '";

            if (String.IsNullOrWhiteSpace(Expression))
            {
                return(new CalcResult(decResult: decimalResult, binResult: binaryResult,
                                      hexResult: hexadecimalResult, message: message, separator: decimalSeparator));
            }

            try
            {
                var myNode = CalculationParser.GrowNodeTree(input: Expression, culture: Culture);

                if (myNode != null)
                {
                    decimal result = myNode.Calculate();

                    decimalResult = result.ToString($"n{PrecisionForDecimalResult}", Culture).
                                    TrimEnd('0').TrimEnd(Separator(culture: Culture));

                    binaryResult = Convertions.ConvertDecimalToBinaryString
                                       (input: Decimal.Parse(decimalResult, Culture), precisionForBinary: PrecisionForBinaryResult,
                                       culture: Culture);

                    hexadecimalResult = Convertions.ConvertDecimalToHexadecimalString
                                            (input: Decimal.Parse(decimalResult, Culture));

                    int signsAfterSeparator = SignsAfterSeparator(number: result, separator: decimalSeparator);

                    message = CheckOnFractionalRounding(afterRounding: decimalResult, precision: PrecisionForDecimalResult,
                                                        message: message, beforeRounding: result.ToString($"n{signsAfterSeparator}", Culture).
                                                        TrimEnd('0').TrimEnd(Separator(culture: Culture)));
                }
            }
            catch (CheckingException exception)
            {
                message = exception.Message;
            }
            catch (DivideByZeroException)
            {
                message           = "Divide by Zero gives you infinity";
                decimalResult     = Infinity;
                binaryResult      = Infinity;
                hexadecimalResult = Infinity;
            }
            catch (OverflowException)
            {
                message = "value is too large or too small";
            }
            catch (Exception)
            {
                message = "Calculation failed";
            }

            return(new CalcResult(decResult: decimalResult, binResult: binaryResult,
                                  hexResult: hexadecimalResult, message: message, separator: decimalSeparator));
        }
示例#30
0
        public void UnixTimeStampToDateTime()
        {
            DateTime date = Convertions.UnixTimeStampToDateTime(1567695600);

            Assert.Equal("9/5/2019 5:00:00 PM", date.ToString());
        }