public void ShouldRefreshCacheToForceReloadOfBdtAndBieLibrary()
        {
            // Setup
            var bdtLibraryMock       = new Mock <IBdtLibrary>();
            var bieLibraryMock       = new Mock <IBieLibrary>();
            var expectedBieLibraries = new[] { bieLibraryMock.Object };
            var expectedBdtLibraries = new[] { bdtLibraryMock.Object };
            var allLibraries         = new List <object>();

            allLibraries.AddRange(expectedBieLibraries);
            allLibraries.AddRange(expectedBdtLibraries);
            var cctsRepositoryMock = new Mock <ICctsRepository>();

            cctsRepositoryMock.Setup(r => r.GetAllLibraries()).Returns(allLibraries);

            // Events
            CcCache            ccCache      = CcCache.GetInstance(cctsRepositoryMock.Object);
            List <IBieLibrary> bieLibraries = ccCache.GetBieLibraries();
            List <IBdtLibrary> bdtLibraries = ccCache.GetBdtLibraries();

            ccCache.GetBieLibraries();
            ccCache.GetBdtLibraries();

            ccCache.Refresh();

            ccCache.GetBieLibraries();
            ccCache.GetBdtLibraries();
            ccCache.GetBieLibraries();
            ccCache.GetBdtLibraries();

            // Assertion and Verification
            Assert.That(bdtLibraries, Is.EquivalentTo(expectedBdtLibraries));
            Assert.That(bieLibraries, Is.EquivalentTo(expectedBieLibraries));
            cctsRepositoryMock.Verify(r => r.GetAllLibraries(), Times.Exactly(2));
        }
        public TemporaryBdtModel(ICctsRepository cctsRepository)
        {
            ccCache = CcCache.GetInstance(cctsRepository);

            mCandidateBdtLibraries    = new List <CandidateBdtLibrary>(ccCache.GetBdtLibraries().ConvertAll(bdtl => new CandidateBdtLibrary(bdtl)));
            mCandidateBdtLibraryNames = new List <string>(mCandidateBdtLibraries.ConvertAll(bdtlname => bdtlname.OriginalBdtLibrary.Name));
            mCandidateCdtLibraries    = new List <CandidateCdtLibrary>(ccCache.GetCdtLibraries().ConvertAll(cdtl => new CandidateCdtLibrary(cdtl)));
            mCandidateCdtLibraryNames = new List <string>(mCandidateCdtLibraries.ConvertAll(cdtlname => cdtlname.OriginalCdtLibrary.Name));
        }
        public void ShouldGetAndCacheBdtLibraries()
        {
            // Setup
            var bdtLibraryMock       = new Mock <IBdtLibrary>();
            var cctsRepositoryMock   = new Mock <ICctsRepository>();
            var expectedBdtLibraries = new[] { bdtLibraryMock.Object };

            cctsRepositoryMock.Setup(r => r.GetAllLibraries()).Returns(expectedBdtLibraries);

            // Events
            CcCache            ccCache      = CcCache.GetInstance(cctsRepositoryMock.Object);
            List <IBdtLibrary> bdtLibraries = ccCache.GetBdtLibraries();

            ccCache.GetBdtLibraries();

            // Assertion and Verification
            Assert.That(bdtLibraries, Is.EquivalentTo(expectedBdtLibraries));
            cctsRepositoryMock.Verify(r => r.GetAllLibraries(), Times.Exactly(1));
        }