Beispiel #1
0
        public void ShouldHandleBattleOfTwoRandomMinionFacePlayers()
        {
            var container = new UnityContainer();

            Dto.UnityConfig.Register(container);
            UnityConfig.Register(container);
            Services.UnityConfig.Register(container);

            var deckParser    = container.Resolve <IDeckPlainTextParser>();
            var deckConverter = container.Resolve <IDeckConverter>();
            var deckDto       = deckParser.ParseDeck(File.ReadAllText(Deck1Path));
            var deck          = deckConverter.Convert(deckDto);

            var playerInitializer1 = new PlayerInitializer()
            {
                Class = CardClass.Hunter,
                Deck  = deck,
                Name  = "Player 1"
            };

            var playerInitializer2 = new PlayerInitializer()
            {
                Class = CardClass.Hunter,
                Deck  = deck,
                Name  = "Player 2"
            };

            var arbiter    = container.Resolve <IGameArbiter>();
            var gameResult = arbiter.HostTheGame(playerInitializer1, playerInitializer2, new DummyMinionFacePlayer(), new DummyMinionFacePlayer());

            gameResult.IsOk.Should().Be(true);
            var playerOneTurns = gameResult.FinalState.Me.Events.Last().Key;

            playerOneTurns.Should().BeGreaterThan(5);
        }
Beispiel #2
0
            public override void Configuration(IAppBuilder app)
            {
                var config = new HttpConfiguration();

                config.MapHttpAttributeRoutes();
                app.UseWebApi(config);
                UnityConfig.Register(config);
            }
Beispiel #3
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     UnityConfig.Register(GlobalConfiguration.Configuration);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Beispiel #4
0
        public static T Resolve <T>()
        {
            if (originalContainer == null)
            {
                originalContainer = new UnityContainer();
                UnityConfig.Register(originalContainer);
            }

            return(originalContainer.Resolve <T>());
        }
Beispiel #5
0
        protected void Application_Start()
        {
            LogConfig.Configure(Server);
            LogService.Init();

            GlobalConfiguration.Configure(WebApiConfig.Register);
            ObjectFactory.Initialize(UnityConfig.Register(GlobalConfiguration.Configuration));
            GlobalConfiguration.Configure(BsonConfig.Register);
            GlobalConfiguration.Configure(PartialFieldConfig.Register);
            GlobalConfiguration.Configuration.EnsureInitialized();
        }
Beispiel #6
0
        public virtual void SetUp()
        {
            if (!_dbWasInitialized)
            {
                DatabaseHelper.ClearTemplateDatabase();
                DatabaseSetup.Init(true);
                UnityConfig.Register();

                DatabaseHelper.CreateTemplateData();
                _dbWasInitialized = true;
            }
        }
Beispiel #7
0
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration httpConfig = new HttpConfiguration();

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
            UnityConfig.Register(httpConfig);
            ConfigureOAuthTokenGeneration(app);

            ConfigureOAuthTokenConsumption(app);

            app.UseWebApi(httpConfig);
        }
Beispiel #8
0
        protected override void RegisterTypes()
        {
            // need to register these built-in pages to make the navigation works if navigating through these pages
            Container.RegisterTypeForNavigation <NavigationPage>();
            Container.RegisterTypeForNavigation <TabbedPage>();
            Container.RegisterTypeForNavigation <MasterDetailPage>();

            Container.RegisterTypeForNavigation <IconTabItemPage>();
            Container.RegisterTypeForNavigation <MainPage>();
            Container.RegisterTypeForNavigation <SyntheticGIFPage>();
            Container.RegisterTypeForNavigation <AdultsGIFPage>();
            Container.RegisterType <IAppService, AppService>();
            UnityConfig.Register(Container);
        }
Beispiel #9
0
        public void Configuration(IAppBuilder app)
        {
            //EntityConfig.Configure(app);

            app.UseCors(CorsOptions.AllowAll);

            var config = new HttpConfiguration();

            UnityConfig.Register(config);
            WebApiConfig.Configure(config);
            RouteConfig.RegisterRoutes(config);

            app.UseWebApi(config);
        }
Beispiel #10
0
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();

            var config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute("Products", "api/{Controller}/{id}");
            app.UseWebApi(config);
            UnityConfig.Register(config);


            app.UseNancy();
        }
        public static void Register(HttpConfiguration config)
        {
            // Serviços e configuração da API da Web

            config.EnableCors();

            // Rotas da API da Web
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            UnityConfig.Register(config);
        }
Beispiel #12
0
        public void ShouldConvertAllCollectibleCards()
        {
            var container = new UnityContainer();

            Dto.UnityConfig.Register(container);
            UnityConfig.Register(container);

            var collectible = JArray.Parse(File.ReadAllText(CollectibleCardJsonPath));
            var parser      = container.Resolve <IHearthstoneJsonCardParser>();
            var cardDtos    = parser.Parse(collectible);

            // filter our default "hero skins" from playable hero cards
            var cardDtosFiltered = cardDtos.Where(x => !(x.Type == CardType.HERO && x.IsElite != true)).ToList();

            var converter = container.Resolve <IHearthstoneJsonCardConverter>();
            var cardVos   = converter.Convert(cardDtosFiltered);

            cardVos.Count().Should().Be(cardDtosFiltered.Count());
            cardVos.Should().NotContainNulls();
        }
        public static void Register(HttpConfiguration config)
        {
            UnityConfig.Register(config);
            config.Filters.Add(new ValidateModelAttribute());


            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
            // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
            // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
            //config.EnableQuerySupport();

            // To disable tracing in your application, please comment out or remove the following line of code
            // For more information, refer to: http://www.asp.net/web-api
            config.EnableSystemDiagnosticsTracing();
        }
Beispiel #14
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            // Configure Web API to use only bearer token authentication.
            config.SuppressDefaultHostAuthentication();
            config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

            //register deferent media type
            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new System.Net.Http.Headers.MediaTypeHeaderValue("text/html"));

            // Enable attribute routing
            config.MapHttpAttributeRoutes();

            //convention-based routing
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                // router template is change from the mvc routing.
                // in mvc routing this name goes as url
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            UnityConfig.Register(config);
        }
Beispiel #15
0
 public static void RegisterTypes(IUnityContainer container)
 {
     UnityConfig.Register(container);
 }
 public UnitTestBase()
 {
     UnityConfig.Register(GlobalConfiguration.Configuration);
 }