public async Task WhenTheConnectorIsCreated()
        {
            _scenarioContext.Should().ContainKey("createdChargeStationResponse");
            _scenarioContext.Should().ContainKey("createdGroupResponse");
            _scenarioContext["createdGroupResponse"].Should().NotBeNull();
            _scenarioContext["createdChargeStationResponse"].Should().NotBeNull();

            GroupResource groupResponse = await _groupDriver.ParseFromResponse <GroupResource>((HttpResponseMessage)_scenarioContext["createdGroupResponse"]);

            ChargeStationResource chargeStationResource = _scenarioContext.ContainsKey("createdChargeStation") ? (ChargeStationResource)_scenarioContext["createdChargeStation"]
                : await _connectorDriver.ParseFromResponse <ChargeStationResource>((HttpResponseMessage)_scenarioContext["createdChargeStationResponse"]);

            SaveConnectorResource createConnector = ((SaveConnectorResource)_scenarioContext["createConnector"]);

            _scenarioContext["createdConnector"] = await _connectorDriver.CreateConnector(groupResponse.Id, chargeStationResource.Id, createConnector.MaxCurrentAmp.Value);
        }
Beispiel #2
0
        public async Task ThenShouldCreateSuccessfullyConnectorsForAllChargeStations(int connectorsCount, float maxCurrent)
        {
            List <HttpResponseMessage> responses = (List <HttpResponseMessage>)_scenarioContext["chargeStationListResponses"];
            GroupResource groupResponse          = await _groupDriver.ParseFromResponse <GroupResource>((HttpResponseMessage)_scenarioContext["createdGroupResponse"]);

            foreach (var response in responses)
            {
                ChargeStationResource chargeStationResource = await _chargeStationDriver.ParseFromResponse <ChargeStationResource>(response);

                for (int i = 0; i < connectorsCount; i++)
                {
                    var connectorResponse = await _connectorDriver.CreateConnector(groupResponse.Id, chargeStationResource.Id, maxCurrent);

                    connectorResponse.StatusCode.Should().Be(201);
                }
            }
        }