public void Clear_can_be_called_from_multiple_threads_concurrently() { var cache = new ViewAssemblyCache(); cache.CheckAssembly(typeof(PregenContextEdmxViews).Assembly, followReferences: true); ExecuteInParallel( () => { cache.Clear(); Assert.Equal(Enumerable.Empty <Assembly>(), cache.Assemblies); }); }
public void Clear_clears_all_cached_assembly_information() { var mockChecker = new Mock <ViewAssemblyChecker>(); mockChecker.Setup(m => m.IsViewAssembly(typeof(object).Assembly)).Returns(true); var cache = new ViewAssemblyCache(mockChecker.Object); cache.CheckAssembly(typeof(object).Assembly, followReferences: false); mockChecker.Verify(m => m.IsViewAssembly(typeof(object).Assembly), Times.Once()); Assert.Equal(new[] { typeof(object).Assembly }, cache.Assemblies); cache.Clear(); Assert.Equal(Enumerable.Empty <Assembly>(), cache.Assemblies); cache.CheckAssembly(typeof(object).Assembly, followReferences: false); mockChecker.Verify(m => m.IsViewAssembly(typeof(object).Assembly), Times.Exactly(2)); Assert.Equal(new[] { typeof(object).Assembly }, cache.Assemblies); }
public void Clear_clears_all_cached_assembly_information() { var mockChecker = new Mock<ViewAssemblyChecker>(); mockChecker.Setup(m => m.IsViewAssembly(typeof(object).Assembly)).Returns(true); var cache = new ViewAssemblyCache(mockChecker.Object); cache.CheckAssembly(typeof(object).Assembly, followReferences: false); mockChecker.Verify(m => m.IsViewAssembly(typeof(object).Assembly), Times.Once()); Assert.Equal(new[] { typeof(object).Assembly }, cache.Assemblies); cache.Clear(); Assert.Equal(Enumerable.Empty<Assembly>(), cache.Assemblies); cache.CheckAssembly(typeof(object).Assembly, followReferences: false); mockChecker.Verify(m => m.IsViewAssembly(typeof(object).Assembly), Times.Exactly(2)); Assert.Equal(new[] { typeof(object).Assembly }, cache.Assemblies); }
public void Clear_can_be_called_from_multiple_threads_concurrently() { var cache = new ViewAssemblyCache(); cache.CheckAssembly(typeof(PregenContextEdmxViews).Assembly, followReferences: true); ExecuteInParallel( () => { cache.Clear(); Assert.Equal(Enumerable.Empty<Assembly>(), cache.Assemblies); }); }