コード例 #1
0
        public void SetDocumentWithExistingRightHashWorks()
        {
            DocumentMetadata m   = new DocumentMetadata();
            SHA1             sha = new SHA1CryptoServiceProvider();

            byte[] bytes = (new UTF8Encoding()).GetBytes("abc");
            string hash  = BitConverter.ToString(sha.ComputeHash(bytes)).Replace("-", "");

            m.Hash = hash;
            m.SetDocument("abc");
            Assert.Equal(hash, m.Hash);
        }
コード例 #2
0
ファイル: Examples.cs プロジェクト: ywangmaxmd/nhin-d
        private static void BuildDocMeta()
        {
            m_docMeta = new DocumentMetadata();
            m_docMeta.SetDocument("Dear Dr. Smith\nYour patient is fine.\nDr. Jones");
            m_docMeta.Author        = new Author();
            m_docMeta.Author.Person = new Person {
                First = "Tom", Last = "Jones", Degree = "M.D."
            };
            m_docMeta.Author.Institutions.Add(new Institution("Direct U"));
            m_docMeta.Class           = C80ClassCode.TransferOfCareReferralNote.ToCodedValue();
            m_docMeta.Comments        = "This is a nice document";
            m_docMeta.Confidentiality = C80Confidentialty.Normal.ToCodedValue();
            m_docMeta.CreatedOn       = new DateTime(2010, 01, 01, 05, 10, 00, DateTimeKind.Utc);
            var evtCodes = new List <CodedValue>();

            evtCodes.Add(new CodedValue("foo", "bar", "test"));
            m_docMeta.EventCodes         = evtCodes;
            m_docMeta.FormatCode         = C80FormatCode.CareManagement.ToCodedValue();
            m_docMeta.FacilityCode       = C80FacilityCodes.PrivatePhysiciansGroupOffice.ToCodedValue();
            m_docMeta.LanguageCode       = "en-us";
            m_docMeta.LegalAuthenticator = new Person {
                First = "Marcus", Last = "Welby", Degree = "M.D", Prefix = "Dr."
            };
            m_docMeta.MediaType       = "text/plain";
            m_docMeta.PatientID       = new PatientID("ABC", "123", "foo");
            m_docMeta.ServiceStart    = new DateTime(2010, 01, 01, 05, 10, 00, DateTimeKind.Utc);
            m_docMeta.ServiceStop     = new DateTime(2010, 01, 01, 05, 10, 00, DateTimeKind.Utc);
            m_docMeta.PracticeSetting = C80ClinicalSpecialties.FamilyPractice.ToCodedValue();
            m_docMeta.SourcePtId      = new PatientID("XYZ", "PDQ", "foo");
            m_docMeta.Patient         = new Person
            {
                First   = "Bob",
                Last    = "Smith",
                Sex     = Sex.Male,
                Dob     = new DateTime(1975, 05, 05, 00, 00, 00, DateTimeKind.Utc),
                Address = new PostalAddress {
                    Street = "150 Main St", City = "Anywhere", State = "CA", Zip = "90000"
                }
            };
            m_docMeta.Title    = "The foo document";
            m_docMeta.UniqueId = "abc123xyz";
            m_docMeta.Uri      = "http://www.google.com?q=the+foo+document";
        }