public void ShouldGetAndCacheParticularCcFromCcLibrary()
        {
            // Setup
            var accMockPerson = new Mock <IAcc>();

            accMockPerson.SetupGet(a => a.Name).Returns("Person");
            var accMockAddress = new Mock <IAcc>();

            accMockAddress.SetupGet(a => a.Name).Returns("Address");

            var ccLibraryMock = new Mock <ICcLibrary>();

            IAcc[] expectedAccs = new[] { accMockAddress.Object, accMockPerson.Object };
            ccLibraryMock.SetupGet(l => l.Name).Returns("cclib1");
            ccLibraryMock.SetupGet(l => l.Accs).Returns(expectedAccs);

            var cctsRepositoryMock = new Mock <ICctsRepository>();

            cctsRepositoryMock.Setup(r => r.GetAllLibraries()).Returns(new[] { ccLibraryMock.Object });

            // Events
            CcCache ccCache = CcCache.GetInstance(cctsRepositoryMock.Object);
            IAcc    acc     = ccCache.GetCcFromCcLibrary("cclib1", "Address");

            ccCache.GetCcFromCcLibrary("cclib1", "Address");

            // Assertion and Verification
            Assert.That(acc, Is.SameAs(accMockAddress.Object));
            ccLibraryMock.VerifyGet(l => l.Accs, Times.Exactly(1));
        }
        public TargetElementStore(MapForceMapping mapForceMapping, ICcLibrary ccLibrary, ICctsRepository cctsRepository)
        {
            cache = CcCache.GetInstance(cctsRepository);

            IEnumerable <SchemaComponent> targetSchemaComponents = mapForceMapping.GetTargetSchemaComponents();

            foreach (SchemaComponent component in targetSchemaComponents)
            {
                Entry entry = component.RootEntry;

                IAcc acc = cache.GetCcFromCcLibrary(ccLibrary.Name, entry.Name);

                if (acc == null)
                {
                    throw new MappingError("ACC '" + entry.Name + "' not found.");
                }
                AddToIndex(entry, acc);
                CreateChildren(entry, acc);
            }
        }