public void TearDown()
        {
            // cleanup storage
            IThreadStorage storage = CreateStorage();

            storage.FreeNamedDataSlot("key");
            storage.FreeNamedDataSlot("KEY");
            storage.FreeNamedDataSlot("KeY");
        }
        public void FreeNamedDataSlotRemovesData()
        {
            IThreadStorage storage = CreateStorage();

            object value1 = new object();

            storage.SetData("key", value1);
            Assert.AreSame(value1, storage.GetData("key"));
            storage.FreeNamedDataSlot("key");
            Assert.AreSame(null, storage.GetData("key"));
        }
Esempio n. 3
0
 /// <summary>
 /// Empties a data slot with the specified name.
 /// </summary>
 /// <remarks>
 /// If the object with the specified <paramref name="name"/> is not found, the method does nothing.
 /// </remarks>
 /// <param name="name">The name of the object to remove.</param>
 public void FreeNamedDataSlot(string name)
 {
     if (primaryStorage.IsAvailable())
     {
         primaryStorage.FreeNamedDataSlot(name);
     }
     else if (secondaryStorage.IsAvailable())
     {
         secondaryStorage.FreeNamedDataSlot(name);
     }
     else
     {
         throw createNotSupportedException();
     }
 }
 /// <summary>
 /// Empties a data slot with the specified name.
 /// </summary>
 /// <param name="name">The name of the data slot to empty.</param>
 public static void FreeNamedDataSlot(string name)
 {
     threadStorage.FreeNamedDataSlot(name);
 }