public void Can_load_depot_from_persistence() { var configNode = TestConfigNode.Node; var persister = new TestPersister(); var expectedBody = "Mun"; var expectedBiome = "East Crater"; var expectedEstablished = true; var expectedSurveyed = true; var expectedResourceName = "ElectricCharge"; var expectedIncomingQuantity = 37; var expectedOutgoingQuantity = 12; var expectedAvailableQuantity = expectedIncomingQuantity - expectedOutgoingQuantity; var consumedResources = new Dictionary <string, int> { { expectedResourceName, expectedAvailableQuantity } }; persister.OnLoad(configNode); Assert.NotEmpty(persister.Depots); var depot = persister.Depots.First(); Assert.Equal(expectedBody, depot.Body); Assert.Equal(expectedBiome, depot.Biome); Assert.Equal(expectedEstablished, depot.IsEstablished); Assert.Equal(expectedSurveyed, depot.IsSurveyed); var result = depot.NegotiateConsumer(consumedResources); Assert.IsType <OkNegotiationResult>(result); }
public void Can_load_route_from_persistence() { var configNode = TestConfigNode.Node; var persister = new TestPersister(); var expectedOriginBody = "Mun"; var expectedOriginBiome = "East Crater"; var expectedDestinationBody = "Minmus"; var expectedDestinationBiome = "Greater Flats"; var expectedPayload = 5; var expectedResourceName = "Ore"; var expectedResourceQuantity = 2; persister.OnLoad(configNode); Assert.NotEmpty(persister.Routes); var route = persister.Routes.First(); Assert.Equal(expectedOriginBody, route.OriginBody); Assert.Equal(expectedOriginBiome, route.OriginBiome); Assert.Equal(expectedDestinationBody, route.DestinationBody); Assert.Equal(expectedDestinationBiome, route.DestinationBiome); Assert.Equal(expectedPayload, route.Payload); Assert.NotEmpty(route.Resources); var resource = route.Resources.First(); Assert.Equal(expectedResourceName, resource.Key); Assert.Equal(expectedResourceQuantity, resource.Value); }