Example #1
0
        public GetDiagramQueryTests(ICommandDispatcher commandDispatcher, IQueryDispatcher queryDispatcher)
        {
            _queryDispatcher = queryDispatcher;

            new TestSpecifications(commandDispatcher, queryDispatcher).Run();
            _conduits = new TestUtilityNetwork(commandDispatcher, queryDispatcher).Run();
        }
Example #2
0
        public async void TestAffixConduitToContainer_ShouldSucceed()
        {
            var nodeContainerId = PlaceNodeContainer(TestRouteNetwork.HH_2);

            var testNetwork = new TestUtilityNetwork(_commandDispatcher, _queryDispatcher).Run();

            var testConduitId = TestUtilityNetwork.MultiConduit_5x10_HH_1_to_HH_10;

            var testConduit = _eventStore.Projections.Get <UtilityNetworkProjection>().SpanEquipments[testConduitId];

            var affixConduitToContainerCommand = new AffixSpanEquipmentToNodeContainer(
                spanEquipmentOrSegmentId: testConduit.SpanStructures[0].SpanSegments[0].Id,
                nodeContainerId: nodeContainerId,
                nodeContainerIngoingSide: NodeContainerSideEnum.West
                );

            var affixResult = await _commandDispatcher.HandleAsync <AffixSpanEquipmentToNodeContainer, Result>(affixConduitToContainerCommand);

            var equipmentQueryResult = await _queryDispatcher.HandleAsync <GetEquipmentDetails, Result <GetEquipmentDetailsResult> >(
                new GetEquipmentDetails(new EquipmentIdList()
            {
                testConduitId
            })
                );

            equipmentQueryResult.IsSuccess.Should().BeTrue();

            equipmentQueryResult.Value.SpanEquipment[testConduitId].NodeContainerAffixes.First(n => n.NodeContainerId == nodeContainerId).NodeContainerIngoingSide.Should().Be(NodeContainerSideEnum.West);

            // Check if an event is published to the notification.utility-network topic having an idlist containing the span equipment id we just created
            var utilityNetworkNotifications = _externalEventProducer.GetMessagesByTopic("notification.utility-network").OfType <RouteNetworkElementContainedEquipmentUpdated>();
            var utilityNetworkUpdatedEvent  = utilityNetworkNotifications.First(n => n.IdChangeSets != null && n.IdChangeSets.Any(i => i.IdList.Any(i => i == nodeContainerId) && i.ChangeType == Events.Changes.ChangeTypeEnum.Modification));

            utilityNetworkUpdatedEvent.AffectedRouteNetworkElementIds.Should().Contain(TestRouteNetwork.HH_2);
        }
Example #3
0
        public async void TestAffixConduitToContainerTwoTimes_ShouldFaild()
        {
            var nodeContainerId = PlaceNodeContainer(TestRouteNetwork.HH_10);

            var testConduits = new TestUtilityNetwork(_commandDispatcher, _queryDispatcher).Run();

            var testConduitId = TestUtilityNetwork.MultiConduit_5x10_HH_1_to_HH_10;

            var testConduit = _eventStore.Projections.Get <UtilityNetworkProjection>().SpanEquipments[testConduitId];

            var affixConduitToContainerCommand = new AffixSpanEquipmentToNodeContainer(
                spanEquipmentOrSegmentId: testConduit.SpanStructures[0].SpanSegments[0].Id,
                nodeContainerId: nodeContainerId,
                nodeContainerIngoingSide: NodeContainerSideEnum.West
                );

            var affixResult1 = await _commandDispatcher.HandleAsync <AffixSpanEquipmentToNodeContainer, Result>(affixConduitToContainerCommand);

            var affixResult2 = await _commandDispatcher.HandleAsync <AffixSpanEquipmentToNodeContainer, Result>(affixConduitToContainerCommand);


            affixResult1.IsSuccess.Should().BeTrue();
            affixResult2.IsSuccess.Should().BeFalse();
            ((AffixSpanEquipmentToNodeContainerError)affixResult2.Errors.First()).Code.Should().Be(AffixSpanEquipmentToNodeContainerErrorCodes.SPAN_EQUIPMENT_ALREADY_AFFIXED_TO_NODE_CONTAINER);
        }
        public ConduitConnectivityTests(IEventStore eventStore, ICommandDispatcher commandDispatcher, IQueryDispatcher queryDispatcher)
        {
            _eventStore        = eventStore;
            _commandDispatcher = commandDispatcher;
            _queryDispatcher   = queryDispatcher;

            new TestSpecifications(commandDispatcher, queryDispatcher).Run();
            _utilityNetwork = new TestUtilityNetwork(commandDispatcher, queryDispatcher).Run();
        }