コード例 #1
0
ファイル: WindowsInstallerTest.cs プロジェクト: roni8686/wix3
        public void TestToString()
        {
            string defaultString         = "1:  ";
            string vegetaShout           = "It's OVER 9000!!";
            string gokuPowerLevel        = "9001";
            string nappaInquiry          = "Vegeta, what's the Scouter say about his power level?";
            string parameterFormatString = "[1]";

            Record rec = new Record(1);

            Assert.AreEqual(defaultString, rec.ToString(), "Testing default FormatString");

            rec.FormatString = String.Empty;
            Assert.AreEqual(defaultString, rec.ToString(), "Explicitly set the FormatString to the empty string.");

            rec.FormatString = vegetaShout;
            Assert.AreEqual(vegetaShout, rec.ToString(), "Testing text only (empty FormatString)");

            rec.FormatString = gokuPowerLevel;
            Assert.AreEqual(gokuPowerLevel, rec.ToString(), "Testing numbers only from a record that wasn't fetched.");

            Record rec2 = new Record(nappaInquiry);

            rec2.FormatString = parameterFormatString;
            Assert.AreEqual(nappaInquiry, rec2.ToString(), "Testing text with a FormatString set.");
        }
コード例 #2
0
ファイル: ParserTest.cs プロジェクト: mezashi184/LTSV
 public void create_line()
 {
     Record record = new Record();
     record["test"] = "sample";
     record["foo"] = "bar";
     Assert.That(record.ToString(), Is.EqualTo("test:sample\tfoo:bar"));
 }
コード例 #3
0
        public ActionResult <Record> Put(
            [SingleNamespace] Namespace @namespace,
            [AcceptableRaw] string raw,
            [AcceptableRecord, FromBody] Record record,
            [FromHeader] User user)
        {
            var dic      = _Database[@namespace];
            var replaced = dic.Find(raw);

            if (replaced is null)
            {
                return(NotFound(new { record = "Record with same 'raw' is not found in the wiki, use POST to insert the record." }));
            }

            dic.AddOrReplace(raw, record);
            dic.Save();

            if (record.ToString(raw) == replaced.ToString(raw))
            {
                return(NoContent());
            }

            _Commit(@namespace, raw, replaced, record, user);
            return(Ok(record));
        }
コード例 #4
0
        private void _Commit(Namespace @namespace, string k, Record o, Record n, User user)
        {
            var verb = "修改";

            if (o is null)
            {
                verb = "添加";
            }
            else if (n is null)
            {
                verb = "删除";
            }

            var message = $@"{verb} {@namespace.ToString().ToLower()}: '{k}' - '{(n ?? o).Name.Raw}'.

|     | 原始标签 | 名称 | 描述 | 外部链接 |
| --- | -------- | ---- | ---- | -------- |
| 修改前 {o?.ToString(k) ?? "| | | | |"}
| 修改后 {n?.ToString(k) ?? "| | | | |"}";

#if !DEBUG
            _RepoClient.Commit(message, user.ToGitIdentity());
            _RepoClient.Push();
#endif
        }
コード例 #5
0
      public void Start()
      {
          Console.WriteLine("Please enter your customer ID: ");
          int      ID       = Int32.Parse(Console.ReadLine());
          Customer customer = _biz.SearchCustomerByID(ID);

          Console.WriteLine(customer.ToString());
          Console.WriteLine(MainMenu.linebreak);
          //Create list with order ID's
          List <Order> orderlist = _biz.GetOrdersByID(ID);

          Console.WriteLine("Order list: ");
          foreach (Order o in orderlist)
          {
              Console.WriteLine(o.ToString());
              List <OrderProducts> opl = _biz.GetOrderProductsByID(o.OrdID);
              Console.WriteLine(MainMenu.linebreak);
              foreach (OrderProducts op in opl)
              {
                  Console.WriteLine(op.ToString());
                  Record opR = _biz.SearchRecordByID(op.RecID);
                  Console.WriteLine(opR.ToString());
              }
          }
          Console.WriteLine(MainMenu.linebreak);
          Console.WriteLine(MainMenu.presskey);
          Console.ReadLine();
      }
コード例 #6
0
        private void RunQuery3(AerospikeClient client, Arguments args, string binName)
        {
            int begin = 20;
            int end   = 30;

            console.Info("Query Predicate: bin3 contains string with 'prefix' and 'suffix'");

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            QueryPolicy policy = new QueryPolicy(client.queryPolicyDefault);

            policy.filterExp = Exp.Build(
                Exp.RegexCompare("prefix.*suffix", RegexFlag.ICASE | RegexFlag.NEWLINE, Exp.StringBin("bin3")));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                while (rs.Next())
                {
                    Record record = rs.Record;
                    console.Info("Record: " + record.ToString());
                }
            }
            finally
            {
                rs.Close();
            }
        }
コード例 #7
0
        public void Formatting()
        {
            Record record = Record.Of("foo", 1,
                                      "bar", "baz");

            Assert.Equal("{foo=1, bar=baz}", record.ToString());
        }
コード例 #8
0
ファイル: WindowsInstallerTest.cs プロジェクト: roni8686/wix3
        public void SeekRecordThenTryFormatString()
        {
            string dbFile = "SeekRecordThenTryFormatString.msi";

            using (Database db = new Database(dbFile, DatabaseOpenMode.CreateDirect))
            {
                WindowsInstallerUtils.InitializeProductDatabase(db);
                WindowsInstallerUtils.CreateTestProduct(db);

                string   parameterFormatString = "[1]";
                string[] properties            = new string[]
                {
                    "SonGoku", "Over 9000",
                };

                string query = "SELECT `Property`, `Value` FROM `Property`";

                using (View view = db.OpenView(query))
                {
                    using (Record rec = new Record(2))
                    {
                        rec[1]           = properties[0];
                        rec[2]           = properties[1];
                        rec.FormatString = parameterFormatString;
                        Console.WriteLine("Record fields before seeking: " + rec[0] + " " + rec[1] + " " + rec[2]);
                        view.Seek(rec);

                        //TODO: Why does view.Seek remove the record fields?
                        Console.WriteLine("Record fields after seeking: " + rec[0] + " " + rec[1] + " " + rec[2]);
                        // After inserting, the format string is invalid.
                        Assert.AreEqual(String.Empty, rec.ToString());
                    }
                }
            }
        }
コード例 #9
0
        public void LWM2M_TLV_Test_07_Decode_BootstrapInfo()
        {
            byte[] Tlv = new byte[]
            {
                0xc8, 0x00, 0x1e, 0x63, 0x6f, 0x61, 0x70, 0x3a,
                0x2f, 0x2f, 0x6c, 0x65, 0x73, 0x68, 0x61, 0x6e,
                0x2e, 0x65, 0x63, 0x6c, 0x69, 0x70, 0x73, 0x65,
                0x2e, 0x6f, 0x72, 0x67, 0x3a, 0x35, 0x36, 0x38,
                0x33, 0xc1, 0x01, 0x01, 0xc1, 0x02, 0x03, 0xc0,
                0x03, 0xc0, 0x04, 0xc0, 0x05, 0xc1, 0x06, 0x03,
                0xc0, 0x07, 0xc0, 0x08, 0xc0, 0x09, 0xc1, 0x0a,
                0x6f, 0xc1, 0x0b, 0x01, 0xc1, 0x0c, 0x00
            };

            object Decoded = InternetContent.Decode(TlvDecoder.ContentType, Tlv, null);

            Assert.IsNotNull(Decoded);

            TlvRecord[] Records = Decoded as TlvRecord[];
            Assert.IsNotNull(Records);

            foreach (TlvRecord Record in Records)
            {
                Console.Out.WriteLine(Record.ToString());
            }
        }
コード例 #10
0
    /// <summary>
    /// Called when the form data record needs to be saved to database.
    /// </summary>
    ///
    protected override void OnSaveData()
    {
        Debug.TraceLine("{0} SaveData: {1}", TraceID,
                        IsAddNew ? "Add New" : Record.ToString());

        base.OnSaveData();
    }
コード例 #11
0
        private void RunQuery3(AerospikeClient client, Arguments args, string binName)
        {
            int begin = 20;
            int end   = 30;

            console.Info("Query Predicate: bin3 contains string with 'prefix' and 'suffix'");

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName, begin, end));
            stmt.SetPredExp(
                PredExp.StringBin("bin3"),
                PredExp.StringValue("prefix.*suffix"),
                PredExp.StringRegex(RegexFlag.ICASE | RegexFlag.NEWLINE)
                );

            RecordSet rs = client.Query(null, stmt);

            try
            {
                while (rs.Next())
                {
                    Record record = rs.Record;
                    console.Info("Record: " + record.ToString());
                }
            }
            finally
            {
                rs.Close();
            }
        }
コード例 #12
0
        public void getRecordToString()
        {
            var record = new Record(new double[] { 1, 2, 3, 4, 5, 6 });
            var expectedRecordString = string.Join(" ", new double[] { 1, 2, 3, 4, 5, 6 });
            var actualRecordString   = record.ToString();

            Assert.AreEqual(expectedRecordString, actualRecordString);
        }
コード例 #13
0
    private Copybook testSingleSentence(string src, Record expected)
    {
        Copybook book = this.parse(src);

        Assert.AreEqual(1, book.Records.Count);
        Assert.AreEqual(expected.ToString(), book.Records[0].ToString());
        return(book);
    }
        public ActionResult WriteToReception(int id)
        {
            ViewData["Message"] = "Your record.";
            Record record = registry.WriteToReceptionDoctor(id, ThePacient.pacient);

            ViewData["Record"] = record.ToString();
            return(View(record));
        }
コード例 #15
0
    /////////////////////////////////////////////////////////////////////////////////////

    #region [ Overriden Base Methods ]

    /// <summary>
    /// Called when the form data record needs to be (re)loaded from database.
    /// </summary>
    /// <remarks>
    /// Updates caption of the MdiForm.
    /// </remarks>
    ///
    protected override void OnLoadData()
    {
        Debug.TraceLine("{0} LoadData: {1}", TraceID,
                        IsAddNew ? "Add New" : Record.ToString());

        MdiForm.Caption = FormTitle;

        base.OnLoadData();
    }
コード例 #16
0
        public void TestEmptyElement()
        {
            var elem = new Record();

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Record></Record>",
                elem.ToString()
                );
        }
コード例 #17
0
        /// <summary>
        /// Converts the file to a string
        /// </summary>
        /// <returns>The file as a string</returns>
        public override string ToString()
        {
            StringBuilder Builder = new StringBuilder();

            foreach (IRecord <FieldType> Record in Records)
            {
                Builder.Append(Record.ToString());
            }
            return(Builder.ToString());
        }
コード例 #18
0
        public static void CreateLog(string type, string msg)
        {
            var rec = new Record(type, msg);

            Data.Add(rec);
            StreamWriter sw = new StreamWriter(Path, true);

            sw.WriteLine(rec.ToString());
            sw.Close();
        }
コード例 #19
0
 public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton)
 {
     return((MessageResult)MessageBox.Show(
                _shell.shellView,
                messageRecord.ToString(),
                "[ErrorDlg_Title]".LocalizeWith(_shell.Runtime.Localize),
                (MessageBoxButtons)(int)buttons,
                (MessageBoxIcon)(int)icon,
                (MessageBoxDefaultButton)(int)defaultButton));
 }
コード例 #20
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>A <see cref="System.String"/> that represents this instance.</returns>
        public override string ToString()
        {
            var Builder = new StringBuilder();

            foreach (var Record in Records)
            {
                Builder.Append(Record.ToString());
            }
            return(Builder.ToString());
        }
コード例 #21
0
ファイル: ReportFragment.cs プロジェクト: TENK14/TwaWallet
        public static ReportFragment NewInstance(Record selectedItem, Action onContinueWith)
        {
            Log.Debug(TAG, $"{nameof(NewInstance)} - {nameof(selectedItem)}:{selectedItem?.ToString()}");

            var frag = new ReportFragment();

            //frag.itemSelectedHandler = onItemSelected;
            frag.SelectedItem          = selectedItem;
            frag.onContinueWithHandler = onContinueWith;
            return(frag);
        }
コード例 #22
0
ファイル: RecordTests.cs プロジェクト: iskorotkov/TSVDatabase
        public void ToStr()
        {
            var r = new Record(1, 2, 3, 4);

            Assert.AreEqual("1\t2\t3\t4", r.ToString());

            r = new Record("a", "bc", "d");
            Assert.AreEqual("a\tbc\td", r.ToString());

            r = new Record(1, "abc", 2, 3, "xyz");
            Assert.AreEqual("1\tabc\t2\t3\txyz", r.ToString());
        }
コード例 #23
0
ファイル: RecordTest.cs プロジェクト: saqibs98/twilio-csharp
        public void TestElementWithTextNode()
        {
            var elem = new Record();

            elem.AddText("Here is the content");

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Record>Here is the content</Record>",
                elem.ToString()
                );
        }
コード例 #24
0
        //public void logError(string p, Exception ex)
        //{
        //    throw new NotImplementedException();
        //}

        //public void logInfo(string p)
        //{
        //    throw new NotImplementedException();
        //}

        internal void uploadContentInTempObject(Record record, string filename, byte[] content, string workTypeName, string fileExt = "pdf")
        {
            string url = settings.getNewTempObjIdRHURL;

            if (String.IsNullOrEmpty(url))
            {
                log.Error("Setting 'GetNewTempObjectIdRequestHandlerURl' were not defined properly.");
                return;
            }

            Dictionary <string, string> requestParams = new Dictionary <string, string>(3);

            requestParams.Add("recordId", record.ID.ToString());
            requestParams.Add("filename", filename);
            requestParams.Add("fileExt", fileExt);
            requestParams.Add("workTypeName", workTypeName);

            //сходить в OTCS через RH, получить айди нового временного документа
            Int32 tempObjectId = getOTCSValue <Int32>(url, requestParams);

            if (tempObjectId == 0)
            {
                log.Error("Failed to get tempObjectId for record: " + record.ToString());
                return;
            }

            //добавить новую версию для этого документа
            string contextId = getVersionContext(tempObjectId);

            if (String.IsNullOrEmpty(contextId))
            {
                updateRecordState(RecordStates.error, record.ID, true, String.Format("Exception in method 'getVersionContext' while trying to get context for temporary object with id: {0}.", tempObjectId));
                return;
            }

            bool versionAdded = addVersion(record, contextId, content, tempObjectId);
            bool descriptionUpdated;

            if (versionAdded)
            {
                descriptionUpdated = updateVersionDescription(record.fileName, tempObjectId);
            }
            else
            {
                incrementIterationsCounter(record, "Exception in method 'addVersion' while trying to add version for temporary object: " + tempObjectId);
                return;
            }
            if (!descriptionUpdated)
            {
                updateRecordState(RecordStates.warn, record.ID, false, "Exception in method 'updateVersionDescription' while trying to update description for record.");
            }
        }
コード例 #25
0
        public void TestElementWithExtraAttributes()
        {
            var elem = new Record();

            elem.SetOption("newParam1", "value");
            elem.SetOption("newParam2", 1);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Record newParam1=\"value\" newParam2=\"1\"></Record>",
                elem.ToString()
                );
        }
コード例 #26
0
        public void ToStringTest()
        {
            Record target = new Record();

            target.Fields.Add(new ControlField("001", "I am data! (But not Data from Star Trek TNG)"));
            //This will be empty, and thus not written
            target.Fields.Add(new DataField("245"));
            string expected = "LDR 00083     2200037   4500" + Environment.NewLine +
                              "001" + "     " + "I am data! (But not Data from Star Trek TNG)" + Environment.NewLine;
            string actual = target.ToString();

            Assert.AreEqual(expected, actual);
        }
コード例 #27
0
        private async void RecordSelected(object sender, ItemTappedEventArgs e)
        {
            Record record = e.Item as Record;

            bool willDeleteRecord = await DisplayAlert(record.ToString(), "Do you want to delete this record ?", "Yes", "No");

            if (willDeleteRecord)
            {
                await RecordsDatabase.GetInstance().DeleteRecord(record);

                _recordsListView.ItemsSource = RecordsDatabase.GetInstance().GetRecords().Result;
            }
        }
コード例 #28
0
ファイル: WindowsInstallerTest.cs プロジェクト: roni8686/wix3
        public void InsertRecordThenTryFormatString()
        {
            string dbFile = "InsertRecordThenTryFormatString.msi";

            using (Database db = new Database(dbFile, DatabaseOpenMode.CreateDirect))
            {
                WindowsInstallerUtils.InitializeProductDatabase(db);
                WindowsInstallerUtils.CreateTestProduct(db);

                string   parameterFormatString = "[1]";
                string[] properties            = new string[]
                {
                    "SonGoku", "Over 9000",
                };

                string query = "SELECT `Property`, `Value` FROM `Property`";

                using (View view = db.OpenView(query))
                {
                    using (Record rec = new Record(2))
                    {
                        rec[1]           = properties[0];
                        rec[2]           = properties[1];
                        rec.FormatString = parameterFormatString;
                        Console.WriteLine("Format String before inserting: " + rec.FormatString);
                        view.Insert(rec);

                        Console.WriteLine("Format String after inserting: " + rec.FormatString);
                        // After inserting, the format string is invalid.
                        Assert.AreEqual(String.Empty, rec.ToString());

                        // Setting the format string manually makes it valid again.
                        rec.FormatString = parameterFormatString;
                        Assert.AreEqual(properties[0], rec.ToString());
                    }
                }
            }
        }
コード例 #29
0
        public void incrementIterationsCounter(Record record, string errorMessage)
        {
            Dictionary <string, string> requestParams = new Dictionary <string, string>(3);

            requestParams.Add("objectId", record.objectId.ToString());
            requestParams.Add("errMsg", errorMessage);

            Int32 res = getOTCSValue <Int32>(getSettings().incrementIterRHURL, requestParams);

            if (res == 0)
            {
                log.Error("Failed to increment content for record: " + record.ToString());
            }
        }
コード例 #30
0
        /// <summary>
        /// Handler for external UI messages.
        /// </summary>
        /// <param name="messageType">The type of message.</param>
        /// <param name="messageRecord">The message details.</param>
        /// <param name="buttons">Buttons to show (unused).</param>
        /// <param name="icon">The icon to show (unused).</param>
        /// <param name="defaultButton">The default button (unused).</param>
        /// <returns>How the message was handled.</returns>
        public MessageResult UIRecordHandler(
            InstallMessage messageType,
            Record messageRecord,
            MessageButtons buttons,
            MessageIcon icon,
            MessageDefaultButton defaultButton)
        {
#if False
            Console.WriteLine("Message type {0}: {1}", messageType.ToString(), this.session.FormatRecord(messageRecord));
#endif

            if (!this.session.IsClosed && 1 <= messageRecord.FieldCount)
            {
                switch (messageType)
                {
                case InstallMessage.ActionStart:
                    // only try to interpret the messages if they're coming from WixRunImmediateUnitTests
                    string action = messageRecord.GetString(1);
                    this.runningTests = Constants.LuxCustomActionName == action;
                    return(MessageResult.OK);

                case InstallMessage.User:
                    if (this.runningTests)
                    {
                        string message = messageRecord.ToString();
                        int    id      = messageRecord.GetInteger(1);

                        if (Constants.TestIdMinimumSuccess <= id && Constants.TestIdMaximumSuccess >= id)
                        {
                            this.OnMessage(NitVerboses.TestPassed(message));
                            ++this.passes;
                        }
                        else if (Constants.TestIdMinimumFailure <= id && Constants.TestIdMaximumFailure >= id)
                        {
                            this.OnMessage(NitErrors.TestFailed(message));
                            ++this.failures;
                        }
                    }

                    return(MessageResult.OK);

                case InstallMessage.Error:
                case InstallMessage.FatalExit:
                    this.OnMessage(NitErrors.PackageFailed(this.session.FormatRecord(messageRecord)));
                    return(MessageResult.Error);
                }
            }

            return(MessageResult.OK);
        }
コード例 #31
0
        public void Post()
        {
            // Arrange
            var recordListBeforeAddition = db.Get();

            // Act
            Record nextRecord = gen.GenerateRandomRecord();

            controller.Post(nextRecord.ToString());
            var recordListAfterAddition = db.Get();

            // Assert
            Assert.IsTrue(recordListAfterAddition.Last() == nextRecord);
        }
コード例 #32
0
ファイル: Communicator.cs プロジェクト: pwdlugosz/Horse
 public override void Communicate(Record Data)
 {
     Console.WriteLine(Data.ToString());
 }
コード例 #33
0
ファイル: RecordTest.cs プロジェクト: rgavrilov/Sogeti
 public void ImplementsToString(Record record, string expectedOutput)
 {
     Assert.That(record.ToString(), Is.EqualTo(expectedOutput));
 }