コード例 #1
0
        public void WhenAddressTransformedToFhir_ThenValuesEqual()
        {
            var address = new ItemTypes.Address
            {
                Description = "John's Office Address",
                IsPrimary   = true,
                Street      = { "1", "Microsoft Way" },
                City        = "KEENE",
                State       = "California",
                Country     = "US",
                PostalCode  = "93531",
                County      = "NorthWest"
            };
            var fhirAddress = address.ToFhir();

            Assert.IsNotNull(fhirAddress);
            Assert.AreEqual(address.Description, fhirAddress.Text);
            Assert.AreEqual(address.Street.Count(), fhirAddress.Line.Count());
            Assert.AreEqual(address.City, fhirAddress.City);
            Assert.AreEqual(address.PostalCode, fhirAddress.PostalCode);
            Assert.AreEqual(address.State, fhirAddress.State);
            Assert.AreEqual(address.Country, fhirAddress.Country);
            Assert.AreEqual(address.County, fhirAddress.District);

            Assert.IsInstanceOfType(fhirAddress.Extension.Single().Value, typeof(FhirBoolean));
            var extensionValue = ((FhirBoolean)fhirAddress.Extension.Single().Value).Value;

            Assert.IsNotNull(extensionValue);
            Assert.AreEqual(true, extensionValue);
        }
コード例 #2
0
        public void WhenMinimumAddressTransformedToFhir_ThenValuesEqual()
        {
            var address = new ItemTypes.Address
            {
                Street     = { "3804 Lakeland ", "Terrace" },
                City       = "KEENE",
                Country    = "US",
                PostalCode = "93531"
            };
            var fhirAddress = address.ToFhir();

            Assert.IsNotNull(fhirAddress);
            Assert.IsTrue(string.IsNullOrEmpty(fhirAddress.Text));
            Assert.IsTrue(string.IsNullOrEmpty(fhirAddress.State));
            Assert.IsTrue(string.IsNullOrEmpty(fhirAddress.District));
            Assert.IsTrue(fhirAddress.Extension.IsNullOrEmpty());

            Assert.AreEqual(address.Street.Count(), fhirAddress.Line.Count());
            Assert.AreEqual(address.City, fhirAddress.City);
            Assert.AreEqual(address.PostalCode, fhirAddress.PostalCode);
            Assert.AreEqual(address.Country, fhirAddress.Country);
        }