public void InvalidRealmExceptionConstructorTest4()
        {
            string errorMessage          = "This is an error message.";
            InvalidRealmException target = new InvalidRealmException(errorMessage);

            Assert.AreEqual(target.Message, errorMessage);
        }
        public void InvalidRealmExceptionConstructorTest3()
        {
            string message = "Realm Id is invalid.";
            InvalidRealmException target = new InvalidRealmException();

            Assert.AreEqual(target.Message, message);
        }
        public void InvalidRealmExceptionConstructorTest5()
        {
            string errorMessage = "This is an error message.";

            System.Exception      innerException = new ArgumentNullException();
            InvalidRealmException target         = new InvalidRealmException(errorMessage, innerException);

            Assert.AreEqual(target.Message, errorMessage);
            Assert.ReferenceEquals(target.InnerException, innerException);
        }
        public void InvalidRealmExceptionConstructorTest()
        {
            string errorMessage          = "Unauthorized";
            string errorCode             = "401";
            string source                = "Intuit.Ipp.Test";
            InvalidRealmException target = new InvalidRealmException(errorMessage, errorCode, source);

            Assert.AreEqual(target.Message, errorMessage);
            Assert.AreEqual(target.ErrorCode, errorCode);
            Assert.AreEqual(target.Source, source);
        }
        public void InvalidRealmExceptionConstructorTest1()
        {
            string errorMessage = "Unauthorized";
            string errorCode    = "401";
            string source       = "Intuit.Ipp.Test";

            System.Exception      innerException = new ArgumentNullException();
            InvalidRealmException target         = new InvalidRealmException(errorMessage, errorCode, source, innerException);

            Assert.AreEqual(target.Message, errorMessage);
            Assert.AreEqual(target.ErrorCode, errorCode);
            Assert.AreEqual(target.Source, source);
            Assert.ReferenceEquals(target.InnerException, innerException);
        }
        public void HandleExceptionTest1()
        {
            string errorMessage = "Unauthorized";
            string errorCode    = "401";
            string source       = "Intuit.Ipp.Test";
            InvalidRealmException innerException = new InvalidRealmException();

            try
            {
                IdsExceptionManager.HandleException(errorMessage, errorCode, source, innerException);
            }
            catch (IdsException target)
            {
                Assert.AreEqual(target.Message, errorMessage);
                Assert.AreEqual(target.ErrorCode, errorCode);
                Assert.AreEqual(target.Source, source);
                Assert.ReferenceEquals(target.InnerException, innerException);
            }
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncService"/> class.
        /// </summary>
        /// <param name="serviceContext">IPP Service Context</param>
        public AsyncService(ServiceContext serviceContext)
        {
            if (serviceContext == null)
            {
                IdsException exception = new IdsException(Resources.ParameterNotNullMessage, new ArgumentNullException("serviceContext", "The Service Context cannot be null."));
                IdsExceptionManager.HandleException(exception);
            }

            if (serviceContext.IppConfiguration.Logger == null)
            {
                IdsException exception = new IdsException("The Logger cannot be null.");
                IdsExceptionManager.HandleException(exception);
            }

            if (string.IsNullOrWhiteSpace(serviceContext.RealmId))
            {
                InvalidRealmException exception = new InvalidRealmException();
                IdsExceptionManager.HandleException(exception);
            }

            this.serviceContext = serviceContext;
        }
        public void InvalidRealmExceptionConstructorTest2()
        {
            string errorMessage = "Unauthorized";
            string errorCode    = "401";
            string source       = "Intuit.Ipp.Test";

            System.Exception      innerException = new ArgumentNullException();
            InvalidRealmException target         = new InvalidRealmException(errorMessage, errorCode, source, innerException);
            InvalidRealmException newTarget      = null;

            using (Stream s = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(s, target);
                s.Position = 0; // Reset stream position
                newTarget  = (InvalidRealmException)formatter.Deserialize(s);
            }

            Assert.IsNotNull(newTarget);
            Assert.AreEqual(newTarget.Message, errorMessage);
            Assert.AreEqual(newTarget.ErrorCode, errorCode);
            Assert.AreEqual(newTarget.Source, source);
            Assert.ReferenceEquals(newTarget.InnerException, innerException);
        }