AspectedRouting/AspectedRouting.Test/MappingTest.cs

26 lines
923 B
C#
Raw Normal View History

using AspectedRouting.Language;
using AspectedRouting.Language.Functions;
using Xunit;
namespace AspectedRouting.Test
{
public class MappingTest
{
[Fact]
public static void SimpleMapping_SimpleHighway_GivesResult()
{
2022-05-04 15:07:57 +02:00
var maxspeed = new Mapping(new[] { "residential", "living_street" },
new[] {
new Constant(30),
new Constant(20)
}
);
2022-05-04 15:07:57 +02:00
var resMaxspeed = maxspeed.Evaluate(new Context(), new Constant("residential"));
Assert.Equal(30, resMaxspeed);
var livingStreetMaxspeed = maxspeed.Evaluate(new Context(), new Constant("living_street"));
Assert.Equal(20, livingStreetMaxspeed);
var undefinedSpeed = maxspeed.Evaluate(new Context(), new Constant("some_unknown_highway_type"));
Assert.Null(undefinedSpeed);
}
}
}