public void Serialize_Object_With_One_IEnumerable_Of_SimpleDummy_Property()
        {
            var dummy = _fixture.Build <EnumerableDummyWithComplexDummy1>()
                        .With(x => x.IEnumerableSimpleDummyProperty, _fixture.CreateMany <SimpleDummy2>().ToList())
                        .Create();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
        public void Serialize_Object_With_One_ICollectionString_Property()
        {
            var dummy = _fixture.Build <AbstractCollectionDummy1>()
                        .With(x => x.ICollectionStringProperty, _fixture.CreateMany <string>().ToList())
                        .Create();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 3
0
        public void Deserialize_Object_With_Datetime()
        {
            var dummy      = _fixture.Create <Dummy6>();
            var serializer = new SwiftySendSerializer(typeof(Dummy6));
            var result     = serializer.Deserialize <Dummy6>(XmlRepresentation.GetXml(dummy));

            Assert.Equal(result.DateTimeProperty.ToString(), dummy.DateTimeProperty.ToString());
            Assert.Equal(result.DateTimeField.ToString(), dummy.DateTimeField.ToString());
        }
Ejemplo n.º 4
0
        public void Deserialize_Object_With_Private_Field_And_Property()
        {
            var dummy = new Dummy7(_fixture.Create <int>(), _fixture.Create <DateTime>());

            var serializer = new SwiftySendSerializer(typeof(Dummy7));
            var result     = serializer.Deserialize <Dummy7>(XmlRepresentation.GetXml(dummy));

            var propertyValue = typeof(Dummy7).GetProperty("IntPrivateProperty", BindingFlags.Instance | BindingFlags.NonPublic);
            var fieldValue    = typeof(Dummy7).GetField("DateTimePrivateField", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.Equal(propertyValue.GetValue(result).ToString(), propertyValue.GetValue(dummy).ToString());
            Assert.Equal(fieldValue.GetValue(result).ToString(), fieldValue.GetValue(dummy).ToString());
        }
Ejemplo n.º 5
0
        public void Deserialize_Object_With_All_Of_The_Base_Types()
        {
            var dummy = _fixture
                        .Build <Dummy5>()
                        .With(x => x.ObjectField, "randome string")
                        .Create();
            var ser         = new SwiftySendSerializer(typeof(Dummy5));
            var xml         = ser.Serialize(dummy);
            var rxml        = XmlRepresentation.GetXml(dummy);
            var newdummy    = ser.Deserialize <Dummy5>(xml);
            var newnewdummy = ser.Deserialize <Dummy5>(rxml);

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
 public ElementDefinitionSummary(string elementName, bool isCollection, bool isChoice,
                                 bool isResource, XmlRepresentation representation, ITypeSerializationInfo[] type,
                                 int order, string nonDefaultNS, bool inSummary, bool isRequired)
 {
     ElementName         = elementName ?? throw new ArgumentNullException(nameof(elementName));
     IsCollection        = isCollection;
     IsChoiceElement     = isChoice;
     IsResource          = isResource;
     Representation      = representation;
     Type                = type ?? throw new ArgumentNullException(nameof(type));
     Order               = order;
     NonDefaultNamespace = nonDefaultNS;
     InSummary           = inSummary;
     IsRequired          = isRequired;
 }
Ejemplo n.º 7
0
        public void Deserialize_Object_With_One_Int_Field_And_One_Enum_Property()
        {
            var dummy = _fixture.Create <Dummy4>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 8
0
        public void Deserialize_Object_With_One_String_Property_And_One_String_Field()
        {
            var dummy = _fixture.Create <Dummy3>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 9
0
 public FhirElementAttribute(string name, ChoiceType choice, XmlRepresentation representation)
 {
     Name             = name;
     Choice           = choice;
     XmlSerialization = representation;
 }
Ejemplo n.º 10
0
        public void Serialize_Object_With_Private_Field_And_Property()
        {
            var dummy = new Dummy7(_fixture.Create <int>(), _fixture.Create <DateTime>());

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 11
0
        public void Serialize_Object_With_Datetime()
        {
            var dummy = _fixture.Create <Dummy6>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 12
0
        public void Serialize_Object_With_All_Of_The_Base_Types()
        {
            var dummy = _fixture.Create <Dummy5>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 13
0
        public void Serialize_Object_With_One_ListString_Property()
        {
            var dummy = _fixture.Create <CollectionDummy1>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 14
0
        public void Serialize_Object_With_One_Complex_Property_And_One_String_Property()
        {
            var dummy = _fixture.Create <ComplexDummy1>();

            Check(() => XmlRepresentation.GetXml(dummy), dummy);
        }
Ejemplo n.º 15
0
 public ElementDefinitionSummary(string elementName, bool isCollection, bool isChoice,
                                 bool isResource, XmlRepresentation representation, ITypeSerializationInfo[] type,
                                 int order, string nonDefaultNS, bool inSummary, bool isRequired)
     : this(elementName, isCollection, isChoice, isResource, representation, null, type, order, nonDefaultNS, inSummary, isRequired)
 {
 }