public void ExactMatch()
 {
     pointcut.Pattern = "System.Object.GetHashCode";
     ExactMatchTests(pointcut);
     pointcut = (AbstractRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(pointcut);
     ExactMatchTests(pointcut);
 }
        public void BinarySerialization()
        {
            Uri        requestUri    = new Uri("http://www.springframework.net");
            HttpMethod requestMethod = HttpMethod.POST;

            byte[] body = new byte[2] {
                0, 1
            };
            HttpHeaders headers = new HttpHeaders();

            headers.ContentType = new MediaType("text", "plain");
            HttpStatusCode statusCode        = HttpStatusCode.Accepted;
            string         statusDescription = "Accepted description";

            HttpResponseException exBefore = new HttpResponseException(requestUri, requestMethod,
                                                                       new HttpResponseMessage <byte[]>(body, headers, statusCode, statusDescription));

            HttpResponseException exAfter = SerializationTestUtils.BinarySerializeAndDeserialize(exBefore) as HttpResponseException;

            Assert.IsNotNull(exAfter);
            Assert.AreEqual(requestUri, exAfter.RequestUri, "Invalid request URI");
            Assert.AreEqual(requestMethod, exAfter.RequestMethod, "Invalid request method");
            Assert.AreEqual(body, exAfter.Response.Body, "Invalid response body");
            Assert.AreEqual(new MediaType("text", "plain"), exAfter.Response.Headers.ContentType, "Invalid response headers");
            Assert.AreEqual(statusCode, exAfter.Response.StatusCode, "Invalid status code");
            Assert.AreEqual(statusDescription, exAfter.Response.StatusDescription, "Invalid status description");
        }
 public void ExactMatchWithGenericType()
 {
     pointcut.Pattern = "System.Collections.Generic.List<string>.Add";
     ExactMatchWithGenericTypeTests(pointcut);
     pointcut = (AbstractRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(pointcut);
     ExactMatchWithGenericTypeTests(pointcut);
 }
        public void Serialization()
        {
            IObjectFactory iof = new XmlObjectFactory(new ReadOnlyXmlTestResource("RegularExpressionSetterTests.xml", GetType()));
            IPerson        p   = (IPerson)iof.GetObject("SerializableSettersAdvised");
            // Interceptor behind regexp advisor
            NopInterceptor nop = (NopInterceptor)iof.GetObject("NopInterceptor");

            Assert.AreEqual(0, nop.Count);

            int newAge = 12;

            // Not advised
            Assert.AreEqual(0, p.GetAge());
            Assert.AreEqual(0, nop.Count);

            // This is proxied
            p.SetAge(newAge);
            Assert.AreEqual(1, nop.Count);
            p.SetAge(newAge);
            Assert.AreEqual(newAge, p.GetAge());
            // Only setter fired
            Assert.AreEqual(2, nop.Count);

            // Serialize and continue...
            p = (IPerson)SerializationTestUtils.SerializeAndDeserialize(p);
            Assert.AreEqual(newAge, p.GetAge());
            // Remembers count, but we need to get a new reference to nop...
            nop = (SerializableNopInterceptor)((IAdvised)p).Advisors[0].Advice;
            Assert.AreEqual(2, nop.Count);
            Assert.AreEqual("SerializableSettersAdvised", p.GetName());
            p.SetAge(newAge + 1);
            Assert.AreEqual(3, nop.Count);
            Assert.AreEqual(newAge + 1, p.GetAge());
        }
        public void TestSerialization()
        {
            AttributeTable attributeTable = new AttributeTable {
                { "one", 1 }
            };

            SerializationTestUtils.TestXmlSerialization(attributeTable);
        }
        public void TestSerializationNullValue()
        {
            AttributeTable attributeTable = new AttributeTable {
                { "null", null }
            };

            SerializationTestUtils.TestXmlSerialization(attributeTable);
        }
        public void Deserialization()
        {
            IPointcut deserializedVersion
                = (IPointcut)SerializationTestUtils.SerializeAndDeserialize(
                      TruePointcut.True);

            Assert.IsTrue(Object.ReferenceEquals(TruePointcut.True, deserializedVersion),
                          "Singleton instance not being deserialized correctly");
        }
        public void Deserialization()
        {
            ITargetSource deserializedVersion
                = (ITargetSource)SerializationTestUtils.SerializeAndDeserialize(
                      EmptyTargetSource.Empty);

            Assert.IsTrue(Object.ReferenceEquals(EmptyTargetSource.Empty, deserializedVersion),
                          "Singleton instance not being deserialized correctly");
        }
        public void Serializability()
        {
            TransactionInterceptor ti = new TransactionInterceptor();

            ti.TransactionAttributes = new NameValueCollection();
            TransactionAttributeSourceAdvisor tas = new TransactionAttributeSourceAdvisor(ti);

            SerializationTestUtils.SerializeAndDeserialize(tas);
        }
示例#10
0
        public void Deserialization()
        {
            ITypeFilter deserializedVersion
                = (ITypeFilter)SerializationTestUtils.SerializeAndDeserialize(
                      TrueTypeFilter.True);

            Assert.IsTrue(Object.ReferenceEquals(TrueTypeFilter.True, deserializedVersion),
                          "Singleton instance not being deserialized correctly");
        }
 public RequestResponseSerializationTest()
 {
     this.producerRequest       = SerializationTestUtils.CreateTestProducerRequest();
     this.producerResponse      = SerializationTestUtils.CreateTestProducerResponse();
     this.fetchRequest          = SerializationTestUtils.CreateTestFetchRequest();
     this.offsetRequest         = SerializationTestUtils.CreateTestOffsetRequest();
     this.offsetResponse        = SerializationTestUtils.CreateTestOffsetResponse();
     this.topicMetadataRequest  = SerializationTestUtils.CreateTestTopicMetadataRequest();
     this.topicMetadataResponse = SerializationTestUtils.CreateTestTopicMetadataResponse();
 }
        public void TestSerialization()
        {
            TestClass testClass = new TestClass {
                Types = new List <Type> {
                    typeof(int), typeof(string)
                }
            };

            SerializationTestUtils.TestXmlSerialization(testClass);
        }
示例#13
0
        private static void CheckSerialization(
            ObjectDefinitionStoreException inex, string expectedName,
            string expectedResourceDescription)
        {
            ObjectDefinitionStoreException outex = (ObjectDefinitionStoreException)
                                                   SerializationTestUtils.SerializeAndDeserialize(inex);

            Assert.AreEqual(expectedName, outex.ObjectName,
                            "The 'ObjectName' property was not serialized / deserialized correctly.");
            Assert.AreEqual(expectedResourceDescription, outex.ResourceDescription,
                            "The 'ResourceDescription' property was not serialized / deserialized correctly.");
        }
        public void BinarySerialization()
        {
            string          message = "Error message";
            DropboxApiError error   = DropboxApiError.OperationNotPermitted;

            DropboxApiException exBefore = new DropboxApiException(message, error);

            DropboxApiException exAfter = SerializationTestUtils.BinarySerializeAndDeserialize(exBefore) as DropboxApiException;

            Assert.IsNotNull(exAfter);
            Assert.AreEqual(message, exAfter.Message, "Invalid message");
            Assert.AreEqual(error, exAfter.Error, "Invalid error");
        }
        public void BinarySerialization()
        {
            string           message = "Error message";
            LinkedInApiError error   = LinkedInApiError.Unknown;

            LinkedInApiException exBefore = new LinkedInApiException(message, error);

            LinkedInApiException exAfter = SerializationTestUtils.BinarySerializeAndDeserialize(exBefore) as LinkedInApiException;

            Assert.IsNotNull(exAfter);
            Assert.AreEqual(message, exAfter.Message, "Invalid message");
            Assert.AreEqual(error, exAfter.Error, "Invalid error");
        }
示例#16
0
        public void BinarySerialization()
        {
            string          message = "Error message";
            TwitterApiError error   = TwitterApiError.RateLimitExceeded;

            TwitterApiException exBefore = new TwitterApiException(message, error);

            TwitterApiException exAfter = SerializationTestUtils.BinarySerializeAndDeserialize(exBefore) as TwitterApiException;

            Assert.IsNotNull(exAfter);
            Assert.AreEqual(message, exAfter.Message, "Invalid message");
            Assert.AreEqual(error, exAfter.Error, "Invalid error");
        }
示例#17
0
        public void Serialization()
        {
            IDictionary typeAliases = new Hashtable();

            typeAliases.Add("LinkedList", typeof(LinkedList).AssemblyQualifiedName);

            TypeAliasConfigurer typeAliasConfigurer = new TypeAliasConfigurer();

            typeAliasConfigurer.TypeAliases = typeAliases;

            typeAliasConfigurer.Order = 1;

            SerializationTestUtils.SerializeAndDeserialize(typeAliasConfigurer);
        }
        public void Serialization()
        {
            IDictionary resourceHandlers = new Hashtable();

            resourceHandlers.Add("httpsss", typeof(UrlResource));

            ResourceHandlerConfigurer resourceHandlerConfiguer = new ResourceHandlerConfigurer();

            resourceHandlerConfiguer.ResourceHandlers = resourceHandlers;


            resourceHandlerConfiguer.Order = 1;

            SerializationTestUtils.SerializeAndDeserialize(resourceHandlerConfiguer);
        }
示例#19
0
        public void Serialization()
        {
            TypedStringValue value        = new TypedStringValue();
            Type             expectedType = typeof(string);

            value.TargetType = expectedType;
            const string expectedValue = "rilo-kiley";

            value.Value = expectedValue;

            object foo = SerializationTestUtils.SerializeAndDeserialize(value);

            Assert.IsNotNull(foo, "Serialization roundtrip must never result in null.");
            TypedStringValue deser = foo as TypedStringValue;

            Assert.IsNotNull(deser,
                             "Serialization roundtrip yielded the wrong Type of object.");
            Assert.AreEqual(expectedType, deser.TargetType,
                            "Serialization roundtrip yielded the wrong TargetType.");
            Assert.AreEqual(expectedValue, deser.Value,
                            "Serialization roundtrip yielded the wrong Value.");
        }
示例#20
0
 public void IsSerializable()
 {
     SerializationTestUtils.IsSerializable <AbstractLogger>();
 }
示例#21
0
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable(TrueTypeFilter.True),
                   "TrueClassFilter must be serializable.");
 }
示例#22
0
 public void TestSerialization()
 {
     SerializationTestUtils.TestXmlSerialization(this.blueprintManager);
 }
 public void SerializationWithNoPatternSupplied()
 {
     pointcut = (AbstractRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(pointcut);
     NoPatternSuppliedTests(pointcut);
 }
        public void InstantiationViaSerialization()
        {
            SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();

            initial.Pattern = "Foo";
            SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(initial);

            Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
            Assert.AreEqual(initial.Pattern, pcut.Pattern, "Pattern property not deserialized correctly.");
        }
示例#25
0
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable <AbstractSimpleLogger>());
 }
示例#26
0
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable(TrueMethodMatcher.True),
                   "TrueMethodMatcher must be serializable.");
 }
        public void TryMatchesAfterSerialization()
        {
            SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();

            initial.Pattern = "Foo";
            SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(initial);

            Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
            Type type    = GetType();
            bool isMatch = pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type);

            Assert.IsFalse(isMatch, "Whoops, should not be matching here at all.");
        }
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable(EmptyTargetSource.Empty),
                   "EmptyTargetSource.Empty must be serializable.");
 }
示例#29
0
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable(new TypedStringValue()),
                   "Must be marked as [Serializable].");
 }
 public void IsSerializable()
 {
     Assert.IsTrue(SerializationTestUtils.IsSerializable(TruePointcut.True),
                   "TruePointcut must be serializable.");
 }