Exemplo n.º 1
0
        public void CanConnectToWithNonExistingExportGroup()
        {
            var importingId = new GroupCompositionId();
            var exportingId = new GroupCompositionId();

            var importEngine = new Mock<IConnectGroups>();
            var graph = new Mock<ICompositionLayer>();
            {
                graph.Setup(g => g.Contains(It.IsAny<GroupCompositionId>()))
                    .Returns<GroupCompositionId>(id => !id.Equals(exportingId));
            }

            var selector = new GroupSelector(importEngine.Object, graph.Object);
            Assert.IsFalse(
                selector.CanConnectTo(
                    importingId,
                    GroupImportDefinition.CreateDefinition("myContract", new GroupRegistrationId("a"), null, null),
                    exportingId));
        }
Exemplo n.º 2
0
        public void CanConnectToWithNonExistingExportGroup()
        {
            var importingId = new GroupCompositionId();
            var exportingId = new GroupCompositionId();

            var importEngine = new Mock <IConnectGroups>();
            var graph        = new Mock <ICompositionLayer>();
            {
                graph.Setup(g => g.Contains(It.IsAny <GroupCompositionId>()))
                .Returns <GroupCompositionId>(id => !id.Equals(exportingId));
            }

            var selector = new GroupSelector(importEngine.Object, graph.Object);

            Assert.IsFalse(
                selector.CanConnectTo(
                    importingId,
                    GroupImportDefinition.CreateDefinition("myContract", new GroupRegistrationId("a"), null, null),
                    exportingId));
        }
Exemplo n.º 3
0
        public void CanConnectToWithNonmatchingGroups()
        {
            var groups = new List <GroupDefinition>
            {
                new GroupDefinition("Group1"),
                new GroupDefinition("Group2"),
                new GroupDefinition("Group3"),
            };
            var importEngine = new Mock <IConnectGroups>();
            {
                importEngine.Setup(i => i.Accepts(It.IsAny <GroupImportDefinition>(), It.IsAny <GroupExportDefinition>()))
                .Returns(false);
                importEngine.Setup(i => i.ExportPassesSelectionCriteria(It.IsAny <GroupExportDefinition>(), It.IsAny <IDictionary <string, object> >()))
                .Returns(true);
            }

            var selector = new GroupSelector(importEngine.Object, new Mock <ICompositionLayer>().Object);

            Assert.IsFalse(
                selector.CanConnectTo(
                    new GroupCompositionId(),
                    GroupImportDefinition.CreateDefinition("myContract", groups[0].Id, null, null),
                    new GroupCompositionId()));
        }
Exemplo n.º 4
0
        public void CanConnectToWithNonmatchingGroups()
        {
            var groups = new List<GroupDefinition>
                {
                    new GroupDefinition("Group1"),
                    new GroupDefinition("Group2"),
                    new GroupDefinition("Group3"),
                };
            var importEngine = new Mock<IConnectGroups>();
            {
                importEngine.Setup(i => i.Accepts(It.IsAny<GroupImportDefinition>(), It.IsAny<GroupExportDefinition>()))
                    .Returns(false);
                importEngine.Setup(i => i.ExportPassesSelectionCriteria(It.IsAny<GroupExportDefinition>(), It.IsAny<IDictionary<string, object>>()))
                    .Returns(true);
            }

            var selector = new GroupSelector(importEngine.Object, new Mock<ICompositionLayer>().Object);
            Assert.IsFalse(
                selector.CanConnectTo(
                    new GroupCompositionId(),
                    GroupImportDefinition.CreateDefinition("myContract", groups[0].Id, null, null),
                    new GroupCompositionId()));
        }