Пример #1
0
        public static void ValidateRequestEntryMinimumRequirementForWithChange(
            FhirTransactionRequestMode expectedRequestMode,
            string path,
            Bundle.HTTPVerb?expectedMethod,
            FhirTransactionRequestEntry actualEntry)
        {
            // For request entry with no change, use the method below.
            Assert.NotEqual(FhirTransactionRequestMode.None, expectedRequestMode);

            Assert.NotNull(actualEntry);
            Assert.Equal(expectedRequestMode, actualEntry.RequestMode);

            if (expectedRequestMode == FhirTransactionRequestMode.Create)
            {
                // If the request mode is create, then it should be client generated resource id.
                Assert.IsType <ClientResourceId>(actualEntry.ResourceId);
            }
            else if (expectedRequestMode == FhirTransactionRequestMode.Update)
            {
                // Otherwise, it should be server generated resource id.
                ServerResourceId serverResourceId = Assert.IsType <ServerResourceId>(actualEntry.ResourceId);

                Assert.Equal(path, serverResourceId.ToString());
            }

            Assert.NotNull(actualEntry.Request);
            Assert.Equal(expectedMethod, actualEntry.Request.Method);
            Assert.Equal(path, actualEntry.Request.Url);

            if (expectedMethod != Bundle.HTTPVerb.DELETE)
            {
                Assert.NotNull(actualEntry.Resource);
            }
        }
 public void GivenAServerResourceId_WhenConvertedToString_ThenCorrectValueShouldBeReturned()
 {
     Assert.Equal(ResourceReference, ServerResourceId.ToString());
 }