Exemplo n.º 1
0
        public override bool DeepEquals(ISymbolStore otherStore)
        {
            var other = otherStore as SymbolStoreSequence;

            return(other != null && _stores.Count == other._stores.Count &&
                   _stores.Zip(other._stores, (a, b) => Tuple.Create(a, b))
                   .All(x => x.Item1.DeepEquals(x.Item2)));
        }
 public SymbolsController(ISymbolStore symbolStore, QuotationContext quotationContext)
 {
     if (symbolStore == null)
     {
         throw new ArgumentNullException(nameof(symbolStore));
     }
     _symbolStore      = symbolStore;
     _quotationContext = quotationContext;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Recursively enumerates the given store and all of its substores
        /// </summary>
        public static IEnumerable <ISymbolStore> GetAllStores(this ISymbolStore store)
        {
            yield return(store);

            foreach (var substore in store.Substores.SelectMany(GetAllStores))
            {
                yield return(substore);
            }
        }
 void AssertEqualStores(ISymbolStore expected, ISymbolStore actual) =>
 Assert.That(expected.DeepEquals(actual), () => {
     var serializerSettings = new JsonSerializerSettings {
         TypeNameHandling = TypeNameHandling.Auto,
         Formatting       = Formatting.Indented,
     };
     var expectedStr = JsonConvert.SerializeObject(expected, serializerSettings);
     var actualStr   = JsonConvert.SerializeObject(actual, serializerSettings);
     return($"Expected: {expectedStr}\nBut was: {actualStr}");
 });
Exemplo n.º 5
0
        public override void SetUp()
        {
            base.SetUp();

            storeA       = new StructuredSymbolStore(fakeFileSystem, STORE_A_PATH);
            storeB       = new StructuredSymbolStore(fakeFileSystem, STORE_B_PATH);
            storeC       = new StructuredSymbolStore(fakeFileSystem, STORE_C_PATH);
            invalidStore = new StructuredSymbolStore(fakeFileSystem, INVALID_PATH);
            symbolServer = new SymbolServer();
        }
Exemplo n.º 6
0
        public override void SetUp()
        {
            base.SetUp();

            storeSequence = new SymbolStoreSequence(fakeBinaryFileUtil);

            cacheA = new StructuredSymbolStore(fakeFileSystem, CACHE_A_PATH, isCache: true);
            cacheB = new StructuredSymbolStore(fakeFileSystem, CACHE_B_PATH, isCache: true);
            storeA = new StructuredSymbolStore(fakeFileSystem, STORE_A_PATH);
            storeB = new StructuredSymbolStore(fakeFileSystem, STORE_B_PATH);
        }
Exemplo n.º 7
0
        public override async Task <IFileReference> FindFileAsync(string filename, BuildId buildId,
                                                                  bool isDebugInfoFile,
                                                                  TextWriter log)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentException(Strings.FilenameNullOrEmpty, "filename");
            }

            ISymbolStore currentCache = null;

            foreach (var store in _stores)
            {
                IFileReference fileReference =
                    await store.FindFileAsync(filename, buildId, false, log);

                if (fileReference != null)
                {
                    if (!store.IsCache && currentCache != null)
                    {
                        try
                        {
                            fileReference = await currentCache.AddFileAsync(fileReference, filename,
                                                                            buildId, log);
                        }
                        catch (Exception e)
                            when(e is NotSupportedException || e is SymbolStoreException ||
                                 e is ArgumentException)
                            {
                                Trace.WriteLine(e.Message);
                                await log.WriteLineAsync(e.Message);
                            }
                    }

                    if (!fileReference.IsFilesystemLocation ||
                        await VerifySymbolFileAsync(fileReference.Location, buildId,
                                                    isDebugInfoFile, log))
                    {
                        return(fileReference);
                    }
                }

                if (store.IsCache)
                {
                    currentCache = store;
                }
            }

            return(null);
        }
Exemplo n.º 8
0
        public void SetUp()
        {
            searchLog = new StringWriter();

            fileReference = Substitute.For <IFileReference>();
            fileReference.IsFilesystemLocation.Returns(true);
            fileReference.Location.Returns(PATH_IN_STORE);

            mockSymbolStore = Substitute.For <ISymbolStore>();
            mockSymbolStore.FindFileAsync(FILENAME, UUID, true, Arg.Any <TextWriter>())
            .Returns(Task.FromResult(fileReference));

            mockSymbolPathParser = Substitute.For <SymbolPathParser>();
            mockSymbolPathParser.Parse(SEARCH_PATHS).Returns(mockSymbolStore);
            moduleFileFinder = new ModuleFileFinder(mockSymbolPathParser);
        }
Exemplo n.º 9
0
 public RedisQuotationProvider(ISymbolStore store, RedistQuotationProviderSetting setting)
 {
     if (store == null)
     {
         throw new ArgumentNullException(nameof(store));
     }
     if (setting == null)
     {
         throw new ArgumentNullException(nameof(setting));
     }
     _store    = store;
     _setting  = setting;
     _channels = setting.Channel;
     _options  = new ConfigurationOptions
     {
         AllowAdmin = true,
         Password   = setting.Password,
         EndPoints  =
         {
             new DnsEndPoint(setting.Server, setting.Port)
         }
     };
 }
Exemplo n.º 10
0
 public override bool DeepEquals(ISymbolStore otherStore) =>
 otherStore is FlatSymbolStore other && _path == other._path;
Exemplo n.º 11
0
 public override bool DeepEquals(ISymbolStore other)
 {
     return(other is NullSymbolStore);
 }
Exemplo n.º 12
0
 public override bool DeepEquals(ISymbolStore otherStore) =>
 otherStore is HttpSymbolStore other && _url == other._url;
Exemplo n.º 13
0
 public override bool DeepEquals(ISymbolStore otherStore) =>
 otherStore is StructuredSymbolStore other && IsCache == other.IsCache &&
 public QuotationStatusPublisher(QuotationContext contetContext, ISymbolStore symbolStore)
 {
     _contetContext = contetContext;
     _symbolStore   = symbolStore;
 }
Exemplo n.º 15
0
 public GameController(IGameStore store, ISymbolStore symbolStore)
 {
     _store       = store;
     _symbolStore = symbolStore;
 }
Exemplo n.º 16
0
 public void SetSearchPaths(string searchPaths)
 {
     _symbolStore = _symbolPathParser.Parse(searchPaths);
 }
Exemplo n.º 17
0
 public ModuleFileFinder(SymbolPathParser symbolPathParser)
 {
     _symbolPathParser = symbolPathParser;
     _symbolStore      = new NullSymbolStore();
 }
Exemplo n.º 18
0
 public DemoQuotationProvider(ISymbolStore stores)
 {
     _stores = stores;
     symbols = stores.Symbols.ToDictionary(s => s.Id, s => s);
 }
Exemplo n.º 19
0
 public abstract bool DeepEquals(ISymbolStore other);
Exemplo n.º 20
0
 public void AddStore(ISymbolStore store)
 {
     _stores.Add(store);
 }