public void AsyncRequestDispatcher_with_Unity_LowerCasify()
        {
            // Arrange
            using (var container = new UnityContainer())
            {
                container.RegisterType<IAsyncExecutableService<LowerCasifyRequest, LowerCasifyResponse>, LowerCaseService>();

                var serviceRegistry = new UnityServiceRegistry(container);
                var sut = new AsyncRequestDispatcher(serviceRegistry);

                var request = new LowerCasifyRequest() { Blob = "this is UPPERCASE" };

                // Act
                var response = sut.Execute(request).Result;

                // Assert
                Assert.AreEqual("this is uppercase", response.LowerCasedBlob);
            }
        }
        public void AsyncRequestDispatcher_with_Unity_Capitalize()
        {
            // Arrange
            using (var container = new UnityContainer())
            {
                container.RegisterType<IAsyncExecutableService<CapitalizeRequest, CapitalizeResponse>, CapitalizationService>();

                var serviceRegistry = new UnityServiceRegistry(container);
                var sut = new AsyncRequestDispatcher(serviceRegistry);

                var request = new CapitalizeRequest { Blob = "this is lowercase" };

                // Act
                var response = sut.Execute(request).Result;

                // Assert
                Assert.AreEqual("THIS IS LOWERCASE", response.CapitalizedBlob);
            }
        }
Exemplo n.º 3
0
 public FooController()
 {
     var container = new UnityContainer();
     var registry = new UnityServiceRegistry(container);
     dispatcher = new RequestDispatcher(registry);
 }
        public void AsyncRequestDispatcher_with_Unity_not_found()
        {
            // Arrange
            using (var container = new UnityContainer())
            {
                container.RegisterType<IAsyncExecutableService<CapitalizeRequest, CapitalizeResponse>, CapitalizationService>();
                var serviceRegistry = new UnityServiceRegistry(container);
                var sut = new AsyncRequestDispatcher(serviceRegistry);

                var request = new LowerCasifyRequest() { Blob = "ThisIsCamelCase" };

                // Act
                sut.Execute(request);
            }
        }