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 ShouldGetAndCacheCdtLibraries() { // Setup var cdtLibraryMock = new Mock <ICdtLibrary>(); var cctsRepositoryMock = new Mock <ICctsRepository>(); var expectedCdtLibraries = new [] { cdtLibraryMock.Object }; cctsRepositoryMock.Setup(r => r.GetAllLibraries()).Returns(expectedCdtLibraries); // Events CcCache ccCache = CcCache.GetInstance(cctsRepositoryMock.Object); List <ICdtLibrary> cdtLibraries = ccCache.GetCdtLibraries(); ccCache.GetCdtLibraries(); // Assertion and Verification Assert.That(cdtLibraries, Is.EquivalentTo(expectedCdtLibraries)); cctsRepositoryMock.Verify(r => r.GetAllLibraries(), Times.Exactly(1)); }