private static void Initialize() { lock (initializationSync) { if (!broken && !initialized) { try { file = GetIsolatedStorage(); reportOriginIdentity = GetOrCreateOriginIdentity(); webRequestHandler = new StandardWebRequestHandler(); observations.Add(observedRequests = new PersistentHashSet(file, "requests.txt", 3)); observations.Add(observedCultures = new PersistentHashSet(file, "cultures.txt", 20)); observations.Add(observedFeatures = new PersistentHashSet(file, "features.txt", int.MaxValue)); // Record site-wide features in use. if (HttpContext.Current != null && HttpContext.Current.ApplicationInstance != null) { // MVC or web forms? // front-end or back end web farm? // url rewriting? ////RecordFeatureUse(IsMVC ? "ASP.NET MVC" : "ASP.NET Web Forms"); } initialized = true; } catch (Exception e) { // This is supposed to be as low-risk as possible, so if it fails, just disable reporting // and avoid rethrowing. broken = true; Logger.Library.Error("Error while trying to initialize reporting.", e); } } } }
public void CreateOnNoArgsReturnsEmptySet() { PersistentHashSet m = PersistentHashSet.create(); Expect(m.count(), EqualTo(0)); Expect(m.meta(), Null); }
public void CreateOnEmptyListReturnsEmptySet() { ArrayList a = new ArrayList(); IPersistentSet m = PersistentHashSet.createWithCheck(a); Expect(m.count(), EqualTo(0)); }
public void DoBigTest(int numEntries) { System.Console.WriteLine("Testing {0} items.", numEntries); Random rnd = new Random(); Dictionary <object, object> dict = new Dictionary <object, object>(numEntries); for (int i = 0; i < numEntries; i++) { int r = rnd.Next(); dict[r] = r; } object[] items = dict.Keys.ToArray(); PersistentHashSet m = (PersistentHashSet)PersistentHashSet.create(items); Expect(m.count(), EqualTo(dict.Count)); foreach (int key in dict.Keys) { Expect(m.contains(key)); } for (ISeq s = m.seq(); s != null; s = s.next()) { Expect(dict.ContainsKey((int)s.first())); } }
public void CreateOnNoArgsReturnsEmptySet() { PersistentHashSet m = PersistentHashSet.create(); Expect(m.count()).To.Equal(0); Expect(m.meta()).To.Be.Null(); }
public void CreateOnEmptyISeqReturnsEmptySet() { object[] items = new object[] { }; ArrayList a = new ArrayList(items); ISeq s = PersistentList.create(a).seq(); IPersistentSet m = PersistentHashSet.create(s); Expect(m.count(), EqualTo(0)); }
public void CreateOnNoArgsReturnsSet() { PersistentHashSet m = PersistentHashSet.create(1, "a"); Expect(m.count(), EqualTo(2)); Expect(m.contains(1)); Expect(m.contains("a")); Expect(m.contains(3), False); Expect(m.meta(), Null); }
public void CreateOnNoArgsReturnsSet() { PersistentHashSet m = PersistentHashSet.create(1, "a"); Expect(m.count()).To.Equal(2); Expect(m.contains(1)); Expect(m.contains("a")); Expect(m.contains(3)).To.Be.False(); Expect(m.meta()).To.Be.Null(); }
public void Setup() { IPersistentMap meta = new DummyMeta(); PersistentHashSet m = PersistentHashSet.create(1, "a", 2, "b"); _objWithNullMeta = (IObj)m; _obj = _objWithNullMeta.withMeta(meta); _expectedType = typeof(PersistentHashSet); }
public void CreateOnISeqReturnsSet() { object[] items = new object[] { 1, "a" }; ArrayList a = new ArrayList(items); ISeq s = PersistentList.create(a).seq(); IPersistentSet m = PersistentHashSet.create(s); Expect(m.count(), EqualTo(2)); Expect(m.contains(1)); Expect(m.contains("a")); Expect(m.contains(3), False); }
public void CreateOnListReturnsSet() { object[] items = new object[] { 1, "a" }; ArrayList a = new ArrayList(items); IPersistentSet m = PersistentHashSet.createWithCheck(a); Expect(m.count(), EqualTo(2)); Expect(m.contains(1)); Expect(m.contains("a")); Expect(m.contains(3), False); }
public void Setup() { _mocks = new MockRepository(); IPersistentMap meta = _mocks.StrictMock <IPersistentMap>(); _mocks.ReplayAll(); PersistentHashSet m = PersistentHashSet.create(1, "a", 2, "b"); _objWithNullMeta = (IObj)m; _obj = _objWithNullMeta.withMeta(meta); _expectedType = typeof(PersistentHashSet); }
protected override object Read(PushbackTextReader r, char leftbracket, object opts) { return(PersistentHashSet.createWithCheck(ReadDelimitedList('}', r, true, opts))); }