public async void TestDrawingCableThrowSingleConduitInWellInsideNodeContainerCC1()
        {
            var utilityNetwork = _eventStore.Projections.Get <UtilityNetworkProjection>();

            var sutRouteNetworkElement = TestRouteNetwork.CC_1;

            // The span equipment/segment where to route the child span equipment
            var routeThroughSpanEquipmentId  = TestUtilityNetwork.MultiConduit_12x7_HH_1_to_HH_10;
            var routeThroughSpanEquipmentId2 = TestUtilityNetwork.CustomerConduit_CC_1_to_SDU_1;

            utilityNetwork.TryGetEquipment <SpanEquipment>(routeThroughSpanEquipmentId, out var routeThoughSpanEquipment);
            utilityNetwork.TryGetEquipment <SpanEquipment>(routeThroughSpanEquipmentId2, out var routeThoughSpanEquipment2);

            var routeThroughSpanSegmentId  = routeThoughSpanEquipment.SpanStructures[6].SpanSegments[0].Id;
            var routeThroughSpanSegmentId2 = routeThoughSpanEquipment2.SpanStructures[0].SpanSegments[0].Id;

            // Setup command
            var specs = new TestSpecifications(_commandDispatcher, _queryDispatcher).Run();

            var routingHops = new RoutingHop[]
            {
                new RoutingHop(TestRouteNetwork.HH_1, routeThroughSpanSegmentId)
            };

            var placeSpanEquipmentCommand = new PlaceSpanEquipmentInUtilityNetwork(Guid.NewGuid(), new UserContext("test", Guid.Empty), Guid.NewGuid(), TestSpecifications.FiberCable_288Fiber, routingHops)
            {
                NamingInfo     = new NamingInfo("K999922222", null),
                ManufacturerId = Guid.NewGuid()
            };

            // Act
            var placeSpanEquipmentResult = await _commandDispatcher.HandleAsync <PlaceSpanEquipmentInUtilityNetwork, Result>(placeSpanEquipmentCommand);

            var getDiagramQueryResult = await _queryDispatcher.HandleAsync <GetDiagram, Result <GetDiagramResult> >(new GetDiagram(sutRouteNetworkElement));

            // Assert
            placeSpanEquipmentResult.IsSuccess.Should().BeTrue();

            var diagram = getDiagramQueryResult.Value.Diagram;

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count(o => o.Style == "FiberCable" && o.Geometry is LineString).Should().Be(7);

            diagram.DiagramObjects.Count(o => o.Style == "OuterConduitOrange" && o.Geometry is Polygon).Should().Be(9);
        }
        public async void TestDrawingCableInsideConduitPassingThrougRouteSegment()
        {
            var utilityNetwork = _eventStore.Projections.Get <UtilityNetworkProjection>();

            var sutRouteNetworkElement = TestRouteNetwork.S2;

            // The span equipment/segment where to route the child span equipment
            var routeThroughSpanEquipmentId = TestUtilityNetwork.MultiConduit_10x10_HH_1_to_HH_10;

            utilityNetwork.TryGetEquipment <SpanEquipment>(routeThroughSpanEquipmentId, out var routeThoughSpanEquipment);

            var routeThroughSpanSegmentId = routeThoughSpanEquipment.SpanStructures[10].SpanSegments[0].Id;

            // Setup command
            var specs = new TestSpecifications(_commandDispatcher, _queryDispatcher).Run();

            var routingHops = new RoutingHop[]
            {
                new RoutingHop(TestRouteNetwork.HH_1, routeThroughSpanSegmentId)
            };

            var placeSpanEquipmentCommand = new PlaceSpanEquipmentInUtilityNetwork(Guid.NewGuid(), new UserContext("test", Guid.Empty), Guid.NewGuid(), TestSpecifications.FiberCable_72Fiber, routingHops)
            {
                NamingInfo     = new NamingInfo("K11112222", null),
                ManufacturerId = Guid.NewGuid()
            };

            // Act
            var placeSpanEquipmentResult = await _commandDispatcher.HandleAsync <PlaceSpanEquipmentInUtilityNetwork, Result>(placeSpanEquipmentCommand);

            var getDiagramQueryResult = await _queryDispatcher.HandleAsync <GetDiagram, Result <GetDiagramResult> >(new GetDiagram(sutRouteNetworkElement));


            var diagram = getDiagramQueryResult.Value.Diagram;

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count(o => o.Style == "FiberCable" && o.Geometry is LineString).Should().Be(2);
            diagram.DiagramObjects.Count(o => o.Label != null && o.Label.Contains("K11112222")).Should().Be(1);
        }
        public async void TestDrawingCableEndOutsideConduitInRouteNode()
        {
            var utilityNetwork = _eventStore.Projections.Get <UtilityNetworkProjection>();

            var sutRouteNetworkElement = TestRouteNetwork.CC_1;

            // Setup
            var specs = new TestSpecifications(_commandDispatcher, _queryDispatcher).Run();

            // Cable directly in route network from HH_1 to CC_1
            var routingHops = new RoutingHop[]
            {
                new RoutingHop(
                    new Guid[] { TestRouteNetwork.HH_1, TestRouteNetwork.S2, TestRouteNetwork.HH_2, TestRouteNetwork.S4, TestRouteNetwork.CC_1 }
                    ),
            };

            var placeSpanEquipmentCommand = new PlaceSpanEquipmentInUtilityNetwork(Guid.NewGuid(), new UserContext("test", Guid.Empty), Guid.NewGuid(), TestSpecifications.FiberCable_192Fiber, routingHops)
            {
                NamingInfo     = new NamingInfo("K12345678", null),
                ManufacturerId = Guid.NewGuid()
            };

            // Act
            var placeSpanEquipmentResult = await _commandDispatcher.HandleAsync <PlaceSpanEquipmentInUtilityNetwork, Result>(placeSpanEquipmentCommand);

            utilityNetwork.TryGetEquipment <SpanEquipment>(placeSpanEquipmentCommand.SpanEquipmentId, out var placedSpanEquipment);


            // Act
            var getDiagramQueryResult = await _queryDispatcher.HandleAsync <GetDiagram, Result <GetDiagramResult> >(new GetDiagram(sutRouteNetworkElement));

            var diagram = getDiagramQueryResult.Value.Diagram;

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count(o => o.Style == "FiberCable" && o.Geometry is LineString).Should().Be(1);
            diagram.DiagramObjects.Count(o => o.Label != null && o.Label.Contains("K12345678")).Should().Be(1);
        }
        public async void TestDrawingCableThroughWellInsideNodeContainerHH2()
        {
            var utilityNetwork = _eventStore.Projections.Get <UtilityNetworkProjection>();

            var sutRouteNetworkElement = TestRouteNetwork.HH_2;


            // The span equipment/segment where to route the child span equipment
            var routeThroughSpanEquipmentId  = TestUtilityNetwork.MultiConduit_12x10_5x10_HH_1_to_HH_2;
            var routeThroughSpanEquipmentId2 = TestUtilityNetwork.FlexConduit_40_Red_HH_2_to_FP_2;

            utilityNetwork.TryGetEquipment <SpanEquipment>(routeThroughSpanEquipmentId, out var routeThoughSpanEquipment);
            utilityNetwork.TryGetEquipment <SpanEquipment>(routeThroughSpanEquipmentId2, out var routeThoughSpanEquipment2);

            var cable1RouteThroughSpanSegmentId1 = routeThoughSpanEquipment.SpanStructures[1].SpanSegments[0].Id;
            var cable1RouteThroughSpanSegmentId2 = routeThoughSpanEquipment2.SpanStructures[0].SpanSegments[0].Id;

            var cable2RouteThroughSpanSegmentId1 = routeThoughSpanEquipment.SpanStructures[2].SpanSegments[0].Id;
            var cable2RouteThroughSpanSegmentId2 = routeThoughSpanEquipment2.SpanStructures[0].SpanSegments[0].Id;


            // Cable 1
            var routingHops = new RoutingHop[]
            {
                new RoutingHop(TestRouteNetwork.HH_1, cable1RouteThroughSpanSegmentId1),
                new RoutingHop(TestRouteNetwork.HH_2, cable1RouteThroughSpanSegmentId2)
            };

            var placeSpanEquipmentCommand = new PlaceSpanEquipmentInUtilityNetwork(Guid.NewGuid(), new UserContext("test", Guid.Empty), Guid.NewGuid(), TestSpecifications.FiberCable_288Fiber, routingHops)
            {
                NamingInfo     = new NamingInfo("K66600000", null),
                ManufacturerId = Guid.NewGuid()
            };

            var placeSpanEquipmentResult1 = await _commandDispatcher.HandleAsync <PlaceSpanEquipmentInUtilityNetwork, Result>(placeSpanEquipmentCommand);

            // Cable 2
            var routingHops2 = new RoutingHop[]
            {
                new RoutingHop(TestRouteNetwork.HH_1, cable2RouteThroughSpanSegmentId1),
                new RoutingHop(TestRouteNetwork.HH_2, cable2RouteThroughSpanSegmentId2)
            };

            var placeSpanEquipmentCommand2 = new PlaceSpanEquipmentInUtilityNetwork(Guid.NewGuid(), new UserContext("test", Guid.Empty), Guid.NewGuid(), TestSpecifications.FiberCable_288Fiber, routingHops2)
            {
                NamingInfo     = new NamingInfo("K66700000", null),
                ManufacturerId = Guid.NewGuid()
            };

            var placeSpanEquipmentResult2 = await _commandDispatcher.HandleAsync <PlaceSpanEquipmentInUtilityNetwork, Result>(placeSpanEquipmentCommand2);

            // Assert
            placeSpanEquipmentResult1.IsSuccess.Should().BeTrue();
            placeSpanEquipmentResult2.IsSuccess.Should().BeTrue();

            var getDiagramQueryResult = await _queryDispatcher.HandleAsync <GetDiagram, Result <GetDiagramResult> >(new GetDiagram(sutRouteNetworkElement));


            var diagram = getDiagramQueryResult.Value.Diagram;

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count(o => o.Style == "FiberCable" && o.Geometry is LineString).Should().Be(9);
        }