public void Initialize() { playlistManager = new PlaylistManager(new PlaylistRepository(new EFDbContext(ContextEnum.BeatBuddyTest)), new UserRepository(new EFDbContext(ContextEnum.BeatBuddyTest))); userManager = new UserManager(new UserRepository(new EFDbContext(ContextEnum.BeatBuddyTest))); organisationManager = new OrganisationManager(new OrganisationRepository(new EFDbContext(ContextEnum.BeatBuddyTest))); _userWithOrganisation = userManager.CreateUser("*****@*****.**", "matthias", "test", "acidshards", ""); _userWithoutOrganisation = userManager.CreateUser("*****@*****.**", "heylen", "jos", "acidshards", ""); playlist = playlistManager.CreatePlaylistForUser("testplaylist", "gekke playlist om te testen", "125", 5, true, "", _userWithOrganisation); _userControllerWithAuthenticatedUserWithOrganisation = MyWebApi.Controller<UserController>() .WithResolvedDependencyFor<PlaylistManager>(playlistManager) .WithResolvedDependencyFor<UserManager>(userManager) .WithResolvedDependencyFor<OrganisationManager>(organisationManager) .WithAuthenticatedUser( u => u.WithIdentifier("NewId") .WithUsername(_userWithOrganisation.Email) .WithClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, _userWithOrganisation.Email)) .WithClaim(new System.Security.Claims.Claim("sub", _userWithOrganisation.Email)) ); _userControllerWithAuthenticatedUserWithoutOrganisation = MyWebApi.Controller<UserController>() .WithResolvedDependencyFor<PlaylistManager>(playlistManager) .WithResolvedDependencyFor<UserManager>(userManager) .WithResolvedDependencyFor<OrganisationManager>(organisationManager) .WithAuthenticatedUser( u => u.WithIdentifier("NewId") .WithUsername(_userWithOrganisation.Email) .WithClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, _userWithoutOrganisation.Email)) .WithClaim(new System.Security.Claims.Claim("sub", _userWithoutOrganisation.Email)) ); Track track = new Track() { Artist = "Metallica", Title = "Master of Puppets (live)", CoverArtUrl = "", Duration = 800, TrackSource = new TrackSource { SourceType = SourceType.YouTube, Url = "https://www.youtube.com/watch?v=kV-2Q8QtCY4" } }; Track addedtrack = playlistManager.AddTrackToPlaylist(playlist.Id, track); organisation = organisationManager.CreateOrganisation("gek organisatie test","",_userWithOrganisation); }