public void ConstructorWithMessageAndInnerExceptionWorks() {
			var inner = new Exception("a");
			var ex = new KeyNotFoundException("The message", inner);
			Assert.IsTrue((object)ex is KeyNotFoundException, "is KeyNotFoundException");
			Assert.IsTrue(ReferenceEquals(ex.InnerException, inner), "InnerException");
			Assert.AreEqual(ex.Message, "The message");
		}
Exemplo n.º 2
0
        private static void LogMessage(string text)
        {
            var randomType = Random.Next(0, 5);

            switch (randomType)
            {
                case 0:
                    var embeddedException = new NotSupportedException();
                    var keyNotFoundException = new KeyNotFoundException("Some wrapped message", embeddedException);
                    Log.Error(text, keyNotFoundException);
                    break;
                case 1:
                    Log.Fatal(text);
                    break;
                case 2:
                    Log.Info(text);
                    break;
                case 3:
                    Log.Warn(text);
                    break;
                default:
                    Log.Debug(text);
                    break;
            }
        }
 public void ConstructorWithMessageWorks()
 {
     var ex = new KeyNotFoundException("The message");
     Assert.True((object)ex is KeyNotFoundException, "is KeyNotFoundException");
     Assert.AreEqual(ex.InnerException, null, "InnerException");
     Assert.AreEqual(ex.Message, "The message");
 }
 public void DefaultConstructorWorks()
 {
     var ex = new KeyNotFoundException();
     Assert.True((object)ex is KeyNotFoundException, "is KeyNotFoundException");
     Assert.AreEqual(ex.InnerException, null, "InnerException");
     Assert.AreEqual(ex.Message, "Key not found.");
 }
 public void TypePropertiesAreCorrect()
 {
     Assert.AreEqual(typeof(KeyNotFoundException).GetClassName(), "Bridge.KeyNotFoundException", "Name");
     object d = new KeyNotFoundException();
     Assert.True(d is KeyNotFoundException, "is KeyNotFoundException");
     Assert.True(d is Exception, "is Exception");
 }
Exemplo n.º 6
0
        public void CustomFn_ReturnsCreatedException()
        {
            var exception = new KeyNotFoundException("Foo");

            var ex = Throws<string>.Instance.Custom(p => exception)(new Param<string>(ParamName, "some fake key"));

            Assert.Equal("Foo", ex.Message);
        }
		public void TypePropertiesAreCorrect() {
			Assert.AreEqual(typeof(KeyNotFoundException).FullName, "ss.KeyNotFoundException", "Name");
			Assert.IsTrue(typeof(KeyNotFoundException).IsClass, "IsClass");
			Assert.AreEqual(typeof(KeyNotFoundException).BaseType, typeof(Exception), "BaseType");
			object d = new KeyNotFoundException();
			Assert.IsTrue(d is KeyNotFoundException, "is KeyNotFoundException");
			Assert.IsTrue(d is Exception, "is Exception");

			var interfaces = typeof(KeyNotFoundException).GetInterfaces();
			Assert.AreEqual(interfaces.Length, 0, "Interfaces length");
		}
        public static EventGenerator GetScenarioByName(string scenario)
        {
            EventGenerator generator;
            if (!ScenarioMap.TryGetValue(scenario, out generator))
            {
                var ex = new KeyNotFoundException("The specified scenario, " + scenario + ", was not recognized.");
                ScenarioSimulatorEventSource.Log.UnknownScenario(scenario, ex);
                throw ex;
            }

            return generator;
        }
Exemplo n.º 9
0
        public static MessageGenerator GetScenarioByName(string scenario)
        {
            MessageGenerator generator;
            if (!ScenarioMap.TryGetValue(scenario, out generator))
            {
                var ex = new KeyNotFoundException("The specified scenario, " + scenario + ", was not recognized.");
                Logger.UnknownScenario(scenario, ex);
                throw ex;
            }

            return generator;
        }
        //методы
        public virtual AmazonCloudFrontClient GetCloudFrontClient()
        {
            RegionEndpoint endpoint = RegionEndpoint.GetBySystemName(Settings.RegionEndpoint);

            bool isUnknownRegion = AmazonConstansts.UNKNOWN_CREDENTIALS_REGION.Equals(
                endpoint.DisplayName, StringComparison.InvariantCultureIgnoreCase);

            if (isUnknownRegion)
            {
                string comment = string.Format("Amazon region с именем {0} не обнаружен.", endpoint);
                Exception exception = new KeyNotFoundException(comment);
                _logger.Exception(exception);
                throw exception;
            }

            var client = new AmazonCloudFrontClient(Settings.AccessKey, Settings.SecretKey, endpoint);
            return client;            
        }
        protected virtual IAmazonS3 GetS3Client()
        {
            RegionEndpoint endpoint = RegionEndpoint.GetBySystemName(Settings.RegionEndpoint);

            bool isUnknownRegion = AmazonConstansts.UNKNOWN_CREDENTIALS_REGION.Equals(
                endpoint.DisplayName, StringComparison.InvariantCultureIgnoreCase);

            if (isUnknownRegion)
            {
                string comment = string.Format(MessageResources.RegionNotFound, endpoint);
                Exception exception = new KeyNotFoundException(comment);
                _logger.Exception(exception);
                throw exception;
            }
            
            return AWSClientFactory.CreateAmazonS3Client(
                Settings.AccessKey, Settings.SecretKey, endpoint
            );
        }
Exemplo n.º 12
0
        static public void initmap() {
            room pos = startroom;
            roomlist.Add(startroom);
            Direction randdir;
            Random rand1 = new Random();
            KeyNotFoundException check = new KeyNotFoundException();
            item randItem;

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next(0,3));
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You stand in a magnificent dining room.", "Dining Room", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for(int i =0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if(randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You are in a billiard room. Fun.", "Billiard Room", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You are in a small chapel.", "Chapel", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You are standing in a greenhouse.", "Greenhouse", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You see a beautiful garden all around you.", "Garden", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("The entrance to a topiary maze confronts you.", "Maze", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You're in a subway stat-wait, nope, it's a kitchen.", "Kitchen", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You're in what looks like someone's bedroom.", "Bedroom", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("You are standing in the biggest linen closet you've ever seen.", "Linen Closet", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }

            while (true)
            {
                pos = randroom();
                randdir = (Direction)(rand1.Next() % 4);
                if (pos.adjacentRooms[randdir] == null)
                {
                    pos.addfrom("Phew, you're now in a room full of garbage. Who would purposely put a room like this in their house?", "Trash Room", randdir);
                    pos = pos.adjacentRooms[randdir];
                    roomlist.Add(pos);
                    for (int i = 0; i < 2; i++)
                    {
                        while (true)
                        {
                            randItem = randRoomItem(rand1);
                            if (randItem.used == false)
                            {
                                pos.roomItemAdd(randItem);
                                break;
                            }
                        }
                    }
                    pos = randroom();
                    break;
                }
            }
                
                    
        }
Exemplo n.º 13
0
        /// <summary>
        /// Converts method arguments, if needed.
        /// <remarks>
        /// Conversion is needed when Types configured for custom serialization or arguments are delegates.
        /// </remarks>
        /// </summary>
        /// <param name="details">Invocation details</param>
        private void Invoke_ConvertMethodArguments(InvocationDetails details)
        {
            details.DelegateParamIndexes = new Dictionary<int, DelegateInterceptor>();
            for (int i = 0; i < details.ParamTypes.Length; i++)
            {
                var delegateParamInterceptor = details.Args[i] as DelegateInterceptor;
                if (delegateParamInterceptor != null)
                {
                    details.DelegateParamIndexes.Add(i, delegateParamInterceptor);
                    continue;
                }

                var container = details.Args[i] as CustomSerializationContainer;
                if (container != null)
                {
                    var serializationHandler = _host.SerializationHandling[container.HandledType];
                    if (serializationHandler == null)
                    {
                        var ex = new KeyNotFoundException(string.Format(LanguageResource.KeyNotFoundException_SerializationHandlerNotFound, container.HandledType.FullName));
                        _host.OnInvokeCanceled(new InvokeCanceledEventArgs() { TrackingID = details.TrackingID, CancelException = ex });
                        throw ex;
                    }

                    details.Args[i] = serializationHandler.Deserialize(container.DataType, container.Data);
                }
            }
        }
Exemplo n.º 14
0
 public void UnLoadValuesTest()
 {
     var root = Param.LoadValues(Common.PathCombine(_inputBasePath, _StyleSettings));
     Assert.AreNotEqual(null, root, "UnLoadValueTest expected data to load into root");
     Param.UnLoadValues();
     try
     {
         var value = Param.Value[Param.InputType];
         Assert.Fail("Values available after UnLoadValues");
     }
     catch (Exception e)
     {
         var expected = new KeyNotFoundException();
         Assert.AreEqual(expected.GetType(), e.GetType());
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Ruft eine bestimmte Methode einer Komponente auf und übergibt die angegebene Nachricht als Parameter.
        /// Für jeden Aufruf wird temporär eine neue Instanz der Komponente erstellt.
        /// </summary>
        /// <param name="trackingID">Aufrufschlüssel zur Nachverfolgung</param>
        /// <param name="interfaceName">Name der Komponentenschnittstelle</param>
        /// <param name="delegateCorrelationSet">Korrelationssatz für die Verdrahtung bestimmter Delegaten oder Ereignisse mit entfernten Methoden</param>
        /// <param name="methodName">Methodenname</param>
        /// <param name="paramDefs">Parameter-Definitionen</param>
        /// <param name="args">Parameter</param>        
        /// <returns>Rückgabewert</returns>
        public object Invoke(Guid trackingID, string interfaceName, List<DelegateCorrelationInfo> delegateCorrelationSet, string methodName, ParameterInfo[] paramDefs, params object[] args)
        {
            // Wenn kein Schnittstellenname angegeben wurde ...
            if (string.IsNullOrEmpty(interfaceName))
                // Ausnahme werfen
                throw new ArgumentException(LanguageResource.ArgumentException_InterfaceNameMissing, "interfaceName");

            // Wenn kein Methodenname angegben wurde ...
            if (string.IsNullOrEmpty(methodName))
                // Ausnahme werfen
                throw new ArgumentException(LanguageResource.ArgumentException_MethodNameMissing, "methodName");

            // Ggf. BeforeInvoke-Abos verarbeiten
            ProcessBeforeInvoke(trackingID, ref interfaceName, ref delegateCorrelationSet, ref methodName, ref args);

            // Wenn für den angegebenen Schnittstellennamen keine Komponente registriert ist ...
            if (!_host.ComponentRegistry.ContainsKey(interfaceName))
            {
                // Ausnahme erzeugen
                KeyNotFoundException ex = new KeyNotFoundException(string.Format("Für die angegebene Schnittstelle '{0}' ist keine Komponente registiert.", interfaceName));

                // InvokeCanceled-Ereignis feuern
                _host.OnInvokeCanceled(new InvokeCanceledEventArgs() { TrackingID = trackingID, CancelException = ex });

                // Ausnahme werfen
                throw ex;
            }
            // Komponentenregistrierung abrufen
            ComponentRegistration registration = _host.ComponentRegistry[interfaceName];

            // Komponenteninstanz erzeugen
            object instance = _host.GetComponentInstance(registration);

            // Implementierungstyp abrufen
            Type type = instance.GetType();

            // Auflistung für Ereignisverdrahtungen
            Dictionary<Guid, Delegate> wiringList = null;

            // Wenn die Komponente SingleCallaktiviert ist ...
            if (registration.ActivationType == ActivationType.SingleCall)
            {
                // Auflistung für Ereignisverdrahtungen erzeugen
                wiringList = new Dictionary<Guid, Delegate>();

                // Bei Bedarf Client- und Server-Komponente miteinander verdrahten
                CreateClientServerWires(type, instance, delegateCorrelationSet, wiringList);
            }
            // Transaktionsbereich
            TransactionScope scope = null;

            // Kontextdaten aus dem Aufrufkontext lesen (Falls welche hinterlegt sind)
            LogicalCallContextData data = CallContext.GetData("__ZyanContextData_" + _host.Name) as LogicalCallContextData;

            // Wenn Kontextdaten übertragen wurden ...
            if (data != null)
            {
                // Wenn ein Sitzungsschlüssel übertragen wurde ...
                if (data.Store.ContainsKey("sessionid"))
                {
                    // Sitzungsschlüssel lesen
                    Guid sessionID = (Guid)data.Store["sessionid"];

                    // Wenn eine Sitzung mit dem angegebenen Schlüssel existiert ...
                    if (_host.SessionManager.ExistSession(sessionID))
                    {
                        // Sitzung abrufen
                        ServerSession session = _host.SessionManager.GetSessionBySessionID(sessionID);

                        // Sitzung verlängern
                        session.Timestamp = DateTime.Now;

                        // Aktuelle Sitzung im Threadspeicher ablegen
                        ServerSession.CurrentSession = session;
                    }
                    else
                    {
                        // Ausnahme erzeugen
                        InvalidSessionException ex = new InvalidSessionException(string.Format("Sitzungsschlüssel '{0}' ist ungültig! Bitte melden Sie sich erneut am Server an.", sessionID.ToString()));

                        // InvokeCanceled-Ereignis feuern
                        _host.OnInvokeCanceled(new InvokeCanceledEventArgs() { TrackingID = trackingID, CancelException = ex });

                        // Ausnahme werfen
                        throw ex;
                    }
                }
                // Wenn eine Transaktion übertragen wurde ...
                if (data.Store.ContainsKey("transaction"))
                    // Transaktionsbereich erzeugen
                    scope = new TransactionScope((Transaction)data.Store["transaction"]);
            }
            else
            {
                // Ausnahme erzeugen
                SecurityException ex = new SecurityException(LanguageResource.SecurityException_ContextInfoMissing);

                // InvokeCanceled-Ereignis feuern
                _host.OnInvokeCanceled(new InvokeCanceledEventArgs() { TrackingID = trackingID, CancelException = ex });

                // Ausnahme werfen
                throw ex;
            }
            // Rückgabewert
            object returnValue = null;

            // Typen-Array (zur Ermittlung der passenden Signatur) erzeugen
            Type[] types = new Type[paramDefs.Length];

            // Auflistung der Indizes von Parametern, für die eine Delegatenverdrahtung notwendig ist
            Dictionary<int,DelegateInterceptor> delegateParamIndexes=new Dictionary<int,DelegateInterceptor>();

            // Alle Parametertypen durchlaufen
            for (int i = 0; i < paramDefs.Length; i++)
            {
                // Typ in Array einfügen
                types[i] = paramDefs[i].ParameterType;

                // Versuchen den aktuellen Parameter in eine Delegaten-Abfangvorrichtung zu casten
                DelegateInterceptor delegateParamInterceptor = args[i] as DelegateInterceptor;

                // Wenn aktuelle Parameter eine Delegaten-Abfangvorrichtung ist ...
                if (delegateParamInterceptor != null)
                    // Parameter der Delegaten-Verdrahtungsliste zufügen
                    delegateParamIndexes.Add(i, delegateParamInterceptor);
            }
            // Ausnahme-Schalter
            bool exceptionThrown = false;

            try
            {
                // Metadaten der aufzurufenden Methode abrufen
                MethodInfo methodInfo = type.GetMethod(methodName, types);

                // Metadaten der Parameter abrufen
                ParameterInfo[] serverMethodParamDefs = methodInfo.GetParameters();

                // Delegaten-Verdrahtungsliste durchlaufen
                foreach(int index in delegateParamIndexes.Keys)
                {
                    // Abfangvorrichtung adressieren
                    DelegateInterceptor delegateParamInterceptor = delegateParamIndexes[index];

                    // Metadaten des passenden Parameters der Serverkomponenten-Methode adressieren
                    ParameterInfo serverMethodParamDef = serverMethodParamDefs[index];

                    // Dynamischen Draht erzeugen
                    object dynamicWire = DynamicWireFactory.Instance.CreateDynamicWire(type, serverMethodParamDef.ParameterType, delegateParamInterceptor);

                    // Typ des dynamischen Drahtes ermitteln
                    Type dynamicWireType = dynamicWire.GetType();

                    // Dynamischen Draht mit Client-Fernsteuerung verdrahten
                    dynamicWireType.GetProperty("Interceptor").SetValue(dynamicWire, delegateParamInterceptor, null);

                    // Delegat zu dynamischem Draht erzeugen
                    Delegate dynamicWireDelegate = Delegate.CreateDelegate(serverMethodParamDef.ParameterType, dynamicWire, dynamicWireType.GetMethod("In"));

                    // Abfangvorrichtung durch dynamischen Draht austauschen
                    args[index] = dynamicWireDelegate;
                }
                // Methode aufrufen
                returnValue = methodInfo.Invoke(instance, args);
            }
            catch (Exception ex)
            {
                // Ausnahme-Schalter setzen
                exceptionThrown = true;

                // InvokeCanceled-Ereignis feuern
                _host.OnInvokeCanceled(new InvokeCanceledEventArgs() { TrackingID = trackingID, CancelException = ex });

                // Ausnahme weiterwerfen
                throw ex;
            }
            finally
            {
                // Wenn ein Transaktionsbereich existiert ...
                if (scope != null)
                {
                    // Wenn keine Ausnahme aufgetreten ist ...
                    if (!exceptionThrown)
                        // Transaktionsbereich abschließen
                        scope.Complete();

                    // Transaktionsbereich entsorgen
                    scope.Dispose();
                }
                // Wenn die Komponente SingleCallaktiviert ist ...
                if (registration.ActivationType == ActivationType.SingleCall)
                    // Verdrahtung aufheben
                    RemoveClientServerWires(type, instance, delegateCorrelationSet, wiringList);
            }
            // Ggf. AfterInvoke-Abos verarbeiten
            ProcessAfterInvoke(trackingID, ref interfaceName, ref delegateCorrelationSet, ref methodName, ref args, ref returnValue);

            // Rückgabewert zurückgeben
            return returnValue;
        }
        private static IAsyncResult QueryItemFromServerAsync(string key, ConfigType type, Action<ConfigItem, Exception> callback)
        {
            string url = new UrlBuilder()
                .SetPath("/ActiveConfig/v1/GetKey")
                .AddParam("appid", _appKey)
                .AddParam("secretkey", _appSecret)
                .AddParam("key", key + ":" + (int)type)
                .GetUrl();

            return Http.GetStringAsync(url, (s, e) =>
            {
                ConfigItem result = null;
                if (e == null)
                {
                    result = null;

                    try
                    {
                        var dict = JSON.Parse(s);
                        if (dict != null)
                        {
                            string code = dict["code"].Value;
                            string msg = dict["msg"].Value;
                            string data = dict["data"].Value;

                            if (code != "0")
                            {
                                Debug.WriteLine("Server return error {0}: {1}", code, msg);
                                e = new ActiveConfigException(msg);
                            }
                            else
                            {
                                if (dict["data"].Count == 1)
                                {
                                    var item = dict["data"][0];
                                    result = new ConfigItem();
                                    result.Key = item["key"].Value;
                                    result.Value = item["value"].Value;
                                    result.Type = (ConfigType)Enum.Parse(typeof(ConfigType), item["type"].Value, true);
                                    result.ExpireTime = Helper.ConvertTime(item["endtime"].Value);
                                    result.MD5 = item["md5"].Value;
                                    result.ID = string.Format("{0}:{1}", (int)result.Type, result.Key);
                                    if (result.Status == ItemStatus.KeyNotFound)
                                    {
                                        e = new KeyNotFoundException(key);
                                    }
                                }
                                else
                                {
                                    e = new KeyNotFoundException(key);
                                }
                            }
                        }
                        else
                        {
                            e = new ActiveConfigException("Parsing json failed");
                        }
                    }
                    catch (Exception err)
                    {
                        e = new ActiveConfigException("Parsing json failed", err);
                    }
                }

                callback(result, e);
            });
        }
Exemplo n.º 17
0
 public void SaveFeaturesTest()
 {
     FeatureSheet target = new FeatureSheet(); // TODO: Initialize to an appropriate value
     TreeView tv = null; // TODO: Initialize to an appropriate value
     // TODO: SaveFeatures depends on settings in Param class being loaded!
     CommonTestMethod.DisableDebugAsserts();
     try
     {
         target.SaveFeatures(tv);
         Assert.Fail("SaveFeatures returned when Param not loaded!");
     }
     catch (Exception e)
     {
         KeyNotFoundException expectedException = new KeyNotFoundException();
         Assert.AreEqual(expectedException.GetType(), e.GetType());
     }
     finally
     {
         CommonTestMethod.EnableDebugAsserts();
     }
 }
 public static InternalError CreateNotFound( KeyNotFoundException notFoundException)
 {
     return new InternalError(ErrorCodes.ErrorCodeEntryDoesNotExist, notFoundException.Message);
 }