예제 #1
0
        public void TestIsNullOrEmpty_Coding()
        {
            var coding = new Coding();

            Assert.IsTrue(coding.IsNullOrEmpty());

            var uri = new FhirUri();

            Assert.IsTrue(uri.IsNullOrEmpty());
            coding.SystemElement = uri;
            Assert.IsTrue(coding.IsNullOrEmpty());

            uri.Value = "http://example.org/";
            Assert.IsFalse(uri.IsNullOrEmpty());
            Assert.IsFalse(coding.IsNullOrEmpty());
            Assert.IsFalse((coding as Base).IsNullOrEmpty());

            uri.Value = null;
            Assert.IsTrue(uri.IsNullOrEmpty());
            Assert.IsTrue(coding.IsNullOrEmpty());

            var extension = new Extension();

            Assert.IsTrue(extension.IsNullOrEmpty());
            coding.Extension.Add(extension);
            Assert.IsTrue(coding.IsNullOrEmpty());

            var extensionValue = new Coding(null, "test");

            Assert.IsFalse(extensionValue.IsNullOrEmpty());
            extension.Value = extensionValue;
            Assert.IsFalse(extension.IsNullOrEmpty());
            Assert.IsFalse(coding.IsNullOrEmpty());
            Assert.IsFalse((coding as Base).IsNullOrEmpty());

            extensionValue.Code = null;
            Assert.IsTrue(extensionValue.IsNullOrEmpty());
            Assert.IsTrue(extension.IsNullOrEmpty());
            Assert.IsTrue(coding.IsNullOrEmpty());

            coding.Extension.Clear();
            Assert.IsTrue(coding.IsNullOrEmpty());
        }
예제 #2
0
        public void TestIsNullOrEmpty_List()
        {
            var codings = new List <Coding>();

            Assert.IsTrue(codings.IsNullOrEmpty());

            var coding = new Coding();

            Assert.IsTrue(coding.IsNullOrEmpty());

            codings.Add(coding);
            Assert.IsFalse(codings.IsNullOrEmpty()); // Empty values are counted... (but shouldn't occur)
            // Assert.IsTrue(codings.IsNullOrEmpty());

            coding.Code = "test";
            Assert.IsFalse(coding.IsNullOrEmpty());
            Assert.IsFalse(codings.IsNullOrEmpty());

            coding.Code = string.Empty;
            Assert.IsTrue(coding.IsNullOrEmpty());
            Assert.IsFalse(codings.IsNullOrEmpty()); // Empty values are counted... (but shouldn't occur)
            // Assert.IsTrue(codings.IsNullOrEmpty());
        }