Ejemplo n.º 1
0
        public DynamicResourceDispatcherTest(ITestOutputHelper output)
        {
            _output = output;
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.Start("test-dynamic-resource-dispatcher");

            var fluentResource = new FluentTestResource(_world);

            var resource = fluentResource.Routes();

            resource.AllocateHandlerPool(_world.Stage);

            var resources = Resources.Are(resource);

            _dispatcher = new TestDispatcher(resources, _world.DefaultLogger);
        }
Ejemplo n.º 2
0
        public ResourceTestFixtures(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            World = World.Start(WorldName);

            ActionPostUser         = new Action(0, "POST", "/users", "Register(body:Vlingo.Http.Tests.Sample.User.UserData userData)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionPatchUserContact = new Action(1, "PATCH", "/users/{userId}/contact", "changeContact(string userId, body:Vlingo.Http.Tests.Sample.User.ContactData contactData)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionPatchUserName    = new Action(2, "PATCH", "/users/{userId}/name", "changeName(string userId, body:Vlingo.Http.Tests.Sample.User.NameData nameData)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionGetUser          = new Action(3, "GET", "/users/{userId}", "queryUser(string userId)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionGetUsers         = new Action(4, "GET", "/users", "queryUsers()", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionGetUserError     = new Action(5, "GET", "/users/{userId}/error", "queryUserError(string userId)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");
            ActionPutUser          = new Action(6, "PUT", "/users/{userId}", "changeUser(string userId, body:Vlingo.Http.Tests.Sample.User.UserData userData)", "Vlingo.Http.Tests.Sample.User.UserDataMapper");


            var actions = new List <Action> {
                ActionPostUser,
                ActionPatchUserContact,
                ActionPatchUserName,
                ActionGetUser,
                ActionGetUsers,
                ActionGetUserError,
                ActionPutUser
            };

            ResourceHandlerType = ConfigurationResource.NewResourceHandlerTypeFor("Vlingo.Http.Tests.Sample.User.UserResource");

            Resource = ConfigurationResource.NewResourceFor("user", ResourceHandlerType, 7, actions, World.DefaultLogger);

            Resource.AllocateHandlerPool(World.Stage);

            var oneResource = new Dictionary <string, IResource>(1);

            oneResource.Add(Resource.Name, Resource);

            Resources  = new Resources(oneResource);
            Dispatcher = new TestDispatcher(Resources, World.DefaultLogger);
        }