public void ConfigureServices(IServiceCollection services) { MapperConfiguration configMapper = new MapperConfiguration( cfg => { cfg.AddProfile(new AutoMapperProfile()); } ); AutomapperConfiguration.Configure(); services.AddMvc(); services.AddScoped <IUnitOfWork, IdentityUnitOfWork>(); services.AddScoped <IFanficService, FanficService>(); services.AddScoped <IFanficTagsService, FanficTagsService>(); services.AddScoped <IUserService, UserService>(); services.AddScoped <IChapterService, ChapterService>(); services.AddScoped <IChapterRatingService, ChapterRatingService>(); services.AddScoped <ICommentService, CommentService>(); services.AddScoped <ICommentRatingService, CommentRatingService>(); services.AddScoped <IGenreService, GenreService>(); services.AddScoped <ITagService, TagService>(); services.AddSingleton(Configuration); services.AddSingleton(ctx => configMapper.CreateMapper()); System.IO.File.WriteAllText("D:/startup.txt", Configuration.GetConnectionString("ApplicationContext")); services.AddDbContext <ApplicationContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("ApplicationContext"), b => b.MigrationsAssembly("iFanfics.Migrations")); }); services.AddIdentity <ApplicationUser, IdentityRole>(opts => { opts.User.RequireUniqueEmail = true; }) .AddEntityFrameworkStores <ApplicationContext>() .AddDefaultTokenProviders(); }
/// <summary> /// Configuration IAppBuilder /// </summary> /// <param name="app"></param> public void Configuration(IAppBuilder app) { var config = new HttpConfiguration(); AutofacConfig.Configure(config); AuthConfig.Configure(app); //WebApiConfig.Register(config); app.UseCors(CorsOptions.AllowAll); app.UseWebApi(config); Database.SetInitializer(new MigrateDatabaseToLatestVersion <SampleAppContext, Configuration>()); //old AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutomapperConfiguration.Configure(); ConfigureOAuthTokenGeneration(app); //Repository.Classes.Shared.AuthRepository authorRepo = new Repository.Classes.Shared.AuthRepository(new SampleAppContext()); //authorRepo.CreateDefaultRolesandUsers(); }
public void ConfigureServices(IServiceCollection services) { MapperConfiguration configMapper = new MapperConfiguration( cfg => { cfg.AddProfile(new AutoMapperProfile()); } ); AutomapperConfiguration.Configure(); services.AddSingleton(ctx => configMapper.CreateMapper()); services.AddSingleton(Configuration); services.AddScoped <IUnitOfWork, UnitOfWork>(); services.AddScoped <IUserService, UserService>(); services.AddScoped <IMessageService, MessageService>(); services.AddScoped <IGroupService, GroupServise>(); services.AddScoped <IGroupUserService, GroupUserServise>(); services.AddScoped <IConnectedUsersService, ConnectedUsersService>(); services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ApplicationContext"), b => b.MigrationsAssembly("MessengerApi.Migrations"))); services.AddIdentity <ApplicationUser, IdentityRole>(opts => { opts.User.RequireUniqueEmail = true; }) .AddEntityFrameworkStores <ApplicationContext>() .AddDefaultTokenProviders(); services.AddSingleton <Microsoft.Extensions.Hosting.IHostedService, ServerObject>(); services.AddMvc(); services.AddSignalR(); }
public virtual void SetUp() { autoMocker = new RhinoAutoMocker <GameDefinitionController>(); autoMocker.Get <IGameDefinitionRetriever>() .Expect(mock => mock.GetTrendingGames(GameDefinitionController.NUMBER_OF_TRENDING_GAMES_TO_SHOW, GameDefinitionController.NUMBER_OF_DAYS_OF_TRENDING_GAMES)) .Return(trendingGames); AutomapperConfiguration.Configure(); urlHelperMock = MockRepository.GenerateMock <UrlHelper>(); autoMocker.ClassUnderTest.Url = urlHelperMock; asyncRequestMock = MockRepository.GenerateMock <HttpRequestBase>(); asyncRequestMock.Expect(x => x.Headers) .Repeat.Any() .Return(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } }); var context = MockRepository.GenerateMock <HttpContextBase>(); context.Expect(x => x.Request) .Repeat.Any() .Return(asyncRequestMock); autoMocker.ClassUnderTest.ControllerContext = new ControllerContext(context, new RouteData(), autoMocker.ClassUnderTest); currentUser = new ApplicationUser() { Id = "user id", CurrentGamingGroupId = 15151 }; }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { Mapper.Initialize(cfg => { AutomapperConfiguration.Configure(cfg); }); DependencyResolver.Start(); this.InitializeComponent(); this.Suspending += OnSuspending; }
public static void ConfigureBusinessServices(this IServiceCollection services) { services.ConfigureRepositoryServices(); services.AddScoped <IUserService, UserService>(); services.AddSingleton(AutomapperConfiguration.Configure().CreateMapper()); }
public static void Run() { // Configure Autofac AutofacWebapiConfig.Initialize(GlobalConfiguration.Configuration); // Configure AutoMapper AutomapperConfiguration.Configure(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind <IUserService>().To <UserService>(); kernel.Bind <IPetService>().To <PetService>(); var automapperConfig = new AutomapperConfiguration(); kernel.Bind <IMapper>().ToConstant(automapperConfig.Configure().CreateMapper()).InSingletonScope(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutomapperConfiguration.Configure(); ContainerConfiguration.ConfigureContainer(); }
public virtual void SetUp() { AutomapperConfiguration.Configure(); _autoMocker = new RhinoAutoMocker <HomeController>(); _autoMocker.Inject <IMapperFactory>(new MapperFactory(new Container(c => { c.AddRegistry <TestRegistry>(); }))); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //hunghv2 init config auto mapper AutomapperConfiguration.Configure(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); _applicationWideWindsorContainer.Install(new WindsorInstaller()); ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(_applicationWideWindsorContainer)); AutomapperConfiguration.Configure(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); }
public void Before() { var builder = new TestControllerBuilder(); _postRepository = MockRepository.GenerateStub <IPostRepository>(); _postRepository.Stub(x => x.GetAllPost()).Return(new List <Post>()); // using real automapper AutomapperConfiguration.Configure(); _sut = new HomeController(_postRepository, new AutomapperWrapper()); builder.InitializeController(_sut); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // don't want to set an initializer since we are doing code first with migrations // and the Configuration will call the DataSeeder. Database.SetInitializer <NemeStatsDbContext>(null); AutomapperConfiguration.Configure(); }
public void LoadAssemblyBindings(IKernel kernel) { var modules = new INinjectModule[] { new ServiceModule("UserDB") }; kernel.Load(modules); kernel.Bind <IUserService>().To <BLL.Services.UserService>(); var config = new AutomapperConfiguration(); var mapper = config.Configure().CreateMapper(); kernel.Bind <IMapper>().ToConstant(mapper).InSingletonScope(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //Load map entity -> viewmodels AutomapperConfiguration.Configure(); //--> Autofac AutofacConfiguration.Register(); }
protected void Application_Start() { _container = Bootstrapper.InitializeContainer(); AutomapperConfiguration.Configure(); AreaRegistration.RegisterAllAreas(); HiperionConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Database.SetInitializer(new DropCreateDatabaseIfModelChanges <UserContext>()); }
public virtual void SetUp() { AutomapperConfiguration.Configure(); playerSummaryBuilderMock = MockRepository.GenerateMock <IPlayerSummaryBuilder>(); topPlayerViewModelBuilderMock = MockRepository.GenerateMock <ITopPlayerViewModelBuilder>(); playedGameRetrieverMock = MockRepository.GenerateMock <IPlayedGameRetriever>(); nemesisHistoryRetrieverMock = MockRepository.GenerateMock <INemesisHistoryRetriever>(); nemesisChangeViewModelBuilderMock = MockRepository.GenerateMock <INemesisChangeViewModelBuilder>(); gamingGroupRetrieverMock = MockRepository.GenerateMock <IGamingGroupRetriever>(); homeControllerPartialMock = MockRepository.GeneratePartialMock <HomeController>( playerSummaryBuilderMock, topPlayerViewModelBuilderMock, playedGameRetrieverMock, nemesisHistoryRetrieverMock, nemesisChangeViewModelBuilderMock, gamingGroupRetrieverMock); }
protected void Application_Start() { MiniProfilerEF6.Initialize(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var container = AutofacConfig.Register(); AutomapperConfiguration.Configure(container); QuartzStart.Run(); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorThemeViewEngine()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ConfigureDependencyInjection(); AutomapperConfiguration.Configure <WebLayerMapperProfile>(cfg => { cfg.AddProfile(new ServiceLayerMapperProfile()); cfg.IgnoreUnmapped(); }); }
public void BaseSetUp() { AutomapperConfiguration.Configure(); this.autoMocker = new RhinoAutoMocker <T>(); var controllerContextMock = MockRepository.GeneratePartialMock <HttpControllerContext>(); var actionDescriptorMock = MockRepository.GenerateMock <HttpActionDescriptor>(); this.autoMocker.ClassUnderTest.ActionContext = new HttpActionContext(controllerContextMock, actionDescriptorMock); this.applicationUser = new ApplicationUser { Id = "application user id", CurrentGamingGroupId = EXPECTED_GAMING_GROUP_ID }; autoMocker.ClassUnderTest.CurrentUser = this.applicationUser; this.autoMocker.ClassUnderTest.Request = new HttpRequestMessage(); this.autoMocker.ClassUnderTest.Request.SetConfiguration(new HttpConfiguration()); }
public virtual void SetUp() { AutomapperConfiguration.Configure(); dataContextMock = MockRepository.GenerateMock <NemeStatsDataContext>(); gameDefinitionRetrieverMock = MockRepository.GenerateMock <IGameDefinitionRetriever>(); gameDefinitionTransformationMock = MockRepository.GenerateMock <IGameDefinitionDetailsViewModelBuilder>(); showingXResultsMessageBuilderMock = MockRepository.GenerateMock <IShowingXResultsMessageBuilder>(); gameDefinitionCreatorMock = MockRepository.GenerateMock <IGameDefinitionSaver>(); urlHelperMock = MockRepository.GenerateMock <UrlHelper>(); boardGameGeekApiClient = MockRepository.GenerateMock <IBoardGameGeekApiClient>(); gameDefinitionControllerPartialMock = MockRepository.GeneratePartialMock <GameDefinitionController>( dataContextMock, gameDefinitionRetrieverMock, gameDefinitionTransformationMock, showingXResultsMessageBuilderMock, gameDefinitionCreatorMock, boardGameGeekApiClient); gameDefinitionControllerPartialMock.Url = urlHelperMock; asyncRequestMock = MockRepository.GenerateMock <HttpRequestBase>(); asyncRequestMock.Expect(x => x.Headers) .Repeat.Any() .Return(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } }); var context = MockRepository.GenerateMock <HttpContextBase>(); context.Expect(x => x.Request) .Repeat.Any() .Return(asyncRequestMock); gameDefinitionControllerPartialMock.ControllerContext = new ControllerContext(context, new RouteData(), gameDefinitionControllerPartialMock); currentUser = new ApplicationUser() { Id = "user id", CurrentGamingGroupId = 15151 }; }
public virtual void SetUp() { AutomapperConfiguration.Configure(); autoMocker = new RhinoAutoMocker <PlayerController>(); autoMocker.PartialMockTheClassUnderTest(); autoMocker.ClassUnderTest.Url = MockRepository.GenerateMock <UrlHelper>(); currentUser = new ApplicationUser() { CurrentGamingGroupId = 123, Id = "app user id" }; autoMocker.Get <HttpRequestBase>().Expect(x => x.Headers) .Repeat.Any() .Return(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } }); var context = MockRepository.GenerateMock <HttpContextBase>(); context.Expect(x => x.Request) .Repeat.Any() .Return(autoMocker.Get <HttpRequestBase>()); autoMocker.Get <HttpRequestBase>().Expect(mock => mock.Url) .Return(new Uri("https://nemestats.com/Details/1")); autoMocker.ClassUnderTest.ControllerContext = new ControllerContext(context, new RouteData(), autoMocker.ClassUnderTest); autoMocker.Get <IPlayerSummaryBuilder>().Expect(mock => mock.GetTopPlayers(Arg <int> .Is.Anything)).Return(new List <TopPlayer>()); autoMocker.Get <INemesisHistoryRetriever>().Expect(mock => mock.GetRecentNemesisChanges(Arg <int> .Is.Anything)).Return(new List <NemesisChange>()); autoMocker.Get <INemesisChangeViewModelBuilder>().Expect(mock => mock.Build(Arg <List <NemesisChange> > .Is.Anything)).Return(new List <NemesisChangeViewModel>()); autoMocker.ClassUnderTest.Expect(mock => mock.ShowTopPlayers()).Return(new ViewResult { ViewName = MVC.Player.Views.TopPlayers, ViewData = new ViewDataDictionary(expectedTopPlayersViewModel) }); autoMocker.ClassUnderTest.Expect(mock => mock.ShowRecentNemesisChanges()).Return(new ViewResult { ViewName = MVC.Player.Views.RecentNemesisChanges, ViewData = new ViewDataDictionary(expectedNemesisChangeViewModel) }); }
public static void RegisterDependencies() { var builder = new ContainerBuilder(); var assemblies = BuildManager.GetReferencedAssemblies().Cast <Assembly>().ToArray(); builder.RegisterControllers(assemblies); builder.RegisterType <LoginClient>() .As <ILoginClient>() .PreserveExistingDefaults(); builder.RegisterType <MeasurementClient>() .As <IMeasurementClient>() .PreserveExistingDefaults(); builder.Register(c => AutomapperConfiguration.Configure()).As <IMapper>() .SingleInstance(); var container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }
/// <summary> /// Constructor /// </summary> public MainWindowVM() { AutomapperConfiguration.Configure(); // create the settings for the application _Settings = new DefaultAppiumAppSettings(); // get the appium engine and wire up to it _AppiumEngine = AppiumEngine.Instance; _AppiumEngine.RunningStatusChanged += _AppiumEngine_RunningStatusChanged; _AppiumEngine.OutputDataReceived += _OutputDataReceived; _AppiumEngine.ErrorDataReceived += _OutputDataReceived; _AppiumEngine.Init(_Settings); if (_Settings.CheckForUpdates) { _AppiumEngine.CheckForUpdate(); } _RemoteServerString = GetPropertyName(() => GeneralSettingsVM.UseRemoteServer); _UpdateRemoteServerSettings(); GeneralSettingsVM.PropertyChanged += _GeneralSettingsVM_PropertyChanged; }
public void SetUp() { autoMocker = new RhinoAutoMocker <UserSessionsController>(); var dataProtector = MockRepository.GenerateMock <IDataProtector>(); userStoreMock = MockRepository.GenerateMock <IUserStore <ApplicationUser> >(); var dataProtectionProvider = MockRepository.GenerateMock <IDataProtectionProvider>(); dataProtectionProvider.Expect(mock => mock.Create("ASP.NET Identity")).Return(dataProtector); var applicationUserManager = MockRepository.GeneratePartialMock <ApplicationUserManager>(userStoreMock, dataProtectionProvider); autoMocker.Inject(applicationUserManager); var controllerContextMock = MockRepository.GeneratePartialMock <HttpControllerContext>(); var actionDescriptorMock = MockRepository.GenerateMock <HttpActionDescriptor>(); autoMocker.ClassUnderTest.ActionContext = new HttpActionContext(controllerContextMock, actionDescriptorMock); autoMocker.ClassUnderTest.Request = new HttpRequestMessage(); autoMocker.ClassUnderTest.Request.SetConfiguration(new HttpConfiguration()); AutomapperConfiguration.Configure(); }
public void Configuration(IAppBuilder app) { ConfigureOAuth(app); AutomapperConfiguration.Configure(); Mapper.AssertConfigurationIsValid(); var builder = new ContainerBuilder(); HttpConfiguration config = new HttpConfiguration(); config.Filters.Add(new AuthorizeAttribute()); app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); WebApiConfig.Register(config); AutofacSetup.RegisterDependencies(ref builder); var container = builder.Build(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); app.UseAutofacMiddleware(container); app.UseAutofacWebApi(config); app.UseWebApi(config); }
public void TestFixtureSetUp() { _autoMocker = new RhinoAutoMocker <PlayerDetailsViewModelBuilder>(); //TODO shouldn't have to do this. Probably need a test base AutomapperConfiguration.Configure(); currentUser = new ApplicationUser() { CurrentGamingGroupId = gamingGroupId, Id = "application user id" }; var gameDefinition1 = new GameDefinition() { Name = "test game 1", Id = gameDefinitionIdThatIsChampionedByCurrentPlayer, }; gameDefinitionThatIsFormerlyChampionedByCurrentPlayer = new GameDefinition { Name = "formerly championed game", Id = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer }; gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer = new GameDefinition { Name = "currently and formerly championed game", Id = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer }; var playedGame1 = new PlayedGame() { Id = 1, GameDefinition = gameDefinition1 }; var playedGame2 = new PlayedGame() { Id = 2, GameDefinitionId = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer }; var playerGameResults = new List <PlayerGameResult>() { new PlayerGameResult() { PlayedGameId = 12, PlayedGame = playedGame1 }, new PlayerGameResult() { PlayedGameId = 13, PlayedGame = playedGame2 } }; normalPlayer = new PlayerVersusPlayerStatistics { OpposingPlayerName = "Jim", OpposingPlayerId = 1, OpposingPlayerActive = false, NumberOfGamesWonVersusThisPlayer = 10, NumberOfGamesLostVersusThisPlayer = 10 }; playerWithNoGamesPlayed = new PlayerVersusPlayerStatistics { OpposingPlayerId = 2 }; minionPlayer = new PlayerVersusPlayerStatistics { OpposingPlayerName = "Minion Player", OpposingPlayerId = 5, NumberOfGamesWonVersusThisPlayer = 20, NumberOfGamesLostVersusThisPlayer = 0 }; nemesisPlayer = new PlayerVersusPlayerStatistics { OpposingPlayerName = "nemesis player", OpposingPlayerId = 3, NumberOfGamesWonVersusThisPlayer = 0, NumberOfGamesLostVersusThisPlayer = 100 }; previousNemesisPlayer = new PlayerVersusPlayerStatistics { OpposingPlayerName = "Previous Nemesis Player", OpposingPlayerId = 13, NumberOfGamesWonVersusThisPlayer = 0, NumberOfGamesLostVersusThisPlayer = 42 }; var nemesis = new Nemesis() { NemesisPlayerId = nemesisPlayer.OpposingPlayerId, NumberOfGamesLost = 3, LossPercentage = 75, NemesisPlayer = new Player() { Name = "Ace Nemesis", } }; var previousNemesis = new Nemesis() { NemesisPlayerId = previousNemesisPlayer.OpposingPlayerId, NumberOfGamesLost = 5, LossPercentage = 66, NemesisPlayer = new Player() { Name = "Bravo Nemesis", } }; playerDetails = new PlayerDetails() { Id = playerId, ApplicationUserId = currentUser.Id, Active = true, Name = "Skipper", LongestWinningStreak = 39, PlayerGameResults = playerGameResults, PlayerStats = new PlayerStatistics() { TotalGames = 5, NemePointsSummary = new NemePointsSummary(1, 3, 5), AveragePlayersPerGame = 3, TotalGamesLost = 1, TotalGamesWon = 4, WinPercentage = 20 }, CurrentNemesis = nemesis, PreviousNemesis = previousNemesis, Minions = new List <Player> { new Player { Id = minionPlayer.OpposingPlayerId } }, GamingGroupId = gamingGroupId, GamingGroupName = "gaming group name", PlayerVersusPlayersStatistics = new List <PlayerVersusPlayerStatistics> { normalPlayer, playerWithNoGamesPlayed, nemesisPlayer, previousNemesisPlayer, minionPlayer }, PlayerGameSummaries = new List <PlayerGameSummary> { new PlayerGameSummary { GameDefinitionId = gameDefinitionIdThatIsChampionedByCurrentPlayer }, new PlayerGameSummary { GameDefinitionId = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer }, new PlayerGameSummary { GameDefinitionId = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer } }, NemePointsSummary = new NemePointsSummary(1, 3, 5), Achievements = new List <PlayerAchievementWinner> { new PlayerAchievementWinner() } }; _autoMocker.Get <IGameResultViewModelBuilder>().Expect(build => build.Build(playerGameResults[0])) .Repeat .Once() .Return(new Models.PlayedGame.GameResultViewModel() { PlayedGameId = playerGameResults[0].PlayedGameId }); _autoMocker.Get <IGameResultViewModelBuilder>().Expect(build => build.Build(playerGameResults[1])) .Repeat .Once() .Return(new Models.PlayedGame.GameResultViewModel() { PlayedGameId = playerGameResults[1].PlayedGameId }); foreach (var player in playerDetails.Minions) { _autoMocker.Get <IMinionViewModelBuilder>().Expect(mock => mock.Build(player)) .Return(new MinionViewModel() { MinionPlayerId = player.Id }); } var championedGames = new List <Champion> { new Champion { GameDefinition = gameDefinition1, GameDefinitionId = gameDefinitionIdThatIsChampionedByCurrentPlayer }, new Champion { GameDefinition = gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer, GameDefinitionId = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer } }; playerDetails.ChampionedGames = championedGames; var formerChampionedGames = new List <GameDefinition> { gameDefinitionThatIsFormerlyChampionedByCurrentPlayer, gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer }; playerDetails.FormerChampionedGames = formerChampionedGames; foreach (var achievement in playerDetails.Achievements) { _autoMocker.Get <ITransformer>() .Expect(mock => mock.Transform <PlayerAchievementSummaryViewModel>(achievement)) .Return(new PlayerAchievementSummaryViewModel()); } playerDetailsViewModel = _autoMocker.ClassUnderTest.Build(playerDetails, twitterMinionBraggingUrl, currentUser); }
public void TestFixtureSetup() { AutomapperConfiguration.Configure(); }
public PersonController() { AutomapperConfiguration.Configure(); _personnelModel = new PersonnelModel(); }