-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brought code over from other repository.
All test cases pass. Everything should be good to go!
- Loading branch information
Showing
287 changed files
with
405,596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
Deploy/ | ||
Streamus *.zip | ||
|
||
################# | ||
## Eclipse | ||
################# | ||
|
||
*.pydevproject | ||
.project | ||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
.classpath | ||
.settings/ | ||
.loadpath | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
*.launch | ||
|
||
# CDT-specific | ||
.cproject | ||
|
||
# PDT-specific | ||
.buildpath | ||
|
||
|
||
################# | ||
## Visual Studio | ||
################# | ||
|
||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.vspscc | ||
.builds | ||
*.dotCover | ||
|
||
## TODO: If you have NuGet Package Restore enabled, uncomment this | ||
#packages/ | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper* | ||
|
||
# Installshield output folder | ||
[Ee]xpress | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish | ||
|
||
# Others | ||
[Bb]in | ||
[Oo]bj | ||
sql | ||
TestResults | ||
*.Cache | ||
ClientBin | ||
stylecop.* | ||
~$* | ||
*.dbmdl | ||
Generated_Code #added for RIA/Silverlight projects | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
|
||
|
||
|
||
############ | ||
## Windows | ||
############ | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
|
||
############# | ||
## Python | ||
############# | ||
|
||
*.py[co] | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
|
||
#Translations | ||
*.mo | ||
|
||
#Mr Developer | ||
.mr.developer.cfg | ||
|
||
# Mac crap | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Streamus Server", "Streamus\Streamus Server.csproj", "{6E1BB86C-18B6-469B-8CAF-8DF671A30906}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6E1BB86C-18B6-469B-8CAF-8DF671A30906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6E1BB86C-18B6-469B-8CAF-8DF671A30906}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6E1BB86C-18B6-469B-8CAF-8DF671A30906}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6E1BB86C-18B6-469B-8CAF-8DF671A30906}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Autofac; | ||
using NUnit.Framework; | ||
using Streamus.Dao; | ||
using Streamus.Domain.Interfaces; | ||
|
||
namespace Streamus.Tests | ||
{ | ||
public abstract class AbstractTest | ||
{ | ||
protected ILifetimeScope Scope { get; set; } | ||
protected IDaoFactory DaoFactory { get; set; } | ||
|
||
[TestFixtureSetUp] | ||
public void TestFixtureSetUp() | ||
{ | ||
// Initialize Autofac for dependency injection. | ||
AutofacRegistrations.RegisterDaoFactory(); | ||
Scope = AutofacRegistrations.Container.BeginLifetimeScope(); | ||
DaoFactory = Scope.Resolve<IDaoFactory>(); | ||
|
||
// Initialize AutoMapper with Streamus' server mappings. | ||
WebApiApplication.CreateAutoMapperMaps(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
</configSections> | ||
<connectionStrings> | ||
<add name="default" connectionString="Data Source=(local);Database=Streamus;Trusted_Connection=True;" /> | ||
</connectionStrings> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework"> | ||
<parameters> | ||
<parameter value="System.Data.SqlServerCe.4.0" /> | ||
</parameters> | ||
</defaultConnectionFactory> | ||
</entityFramework> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> | ||
</startup> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
114 changes: 114 additions & 0 deletions
114
Streamus.Tests/Controller Tests/PlaylistControllerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Streamus.Controllers; | ||
using Streamus.Dao; | ||
using Streamus.Domain; | ||
using Streamus.Domain.Interfaces; | ||
using Streamus.Domain.Managers; | ||
using Streamus.Dto; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Streamus.Tests.Controller_Tests | ||
{ | ||
[TestFixture] | ||
public class PlaylistControllerTest : AbstractTest | ||
{ | ||
private static readonly UserManager UserManager = new UserManager(); | ||
private static readonly PlaylistItemController PlaylistItemController = new PlaylistItemController(); | ||
private static readonly ShareCodeManager ShareCodeManager = new ShareCodeManager(); | ||
private static readonly PlaylistController PlaylistController = new PlaylistController(); | ||
private IFolderDao FolderDao { get; set; } | ||
|
||
/// <summary> | ||
/// This code is only ran once for the given TestFixture. | ||
/// </summary> | ||
[TestFixtureSetUp] | ||
public new void TestFixtureSetUp() | ||
{ | ||
try | ||
{ | ||
FolderDao = DaoFactory.GetFolderDao(); | ||
} | ||
catch (TypeInitializationException exception) | ||
{ | ||
throw exception.InnerException; | ||
} | ||
} | ||
|
||
[Test] | ||
public void DeletePlaylist_NextToBigPlaylist_NoStackOverflowException() | ||
{ | ||
Folder folder = UserManager.CreateUser().Folders.First(); | ||
Guid firstPlaylistId = folder.Playlists.First().Id; | ||
|
||
PlaylistDto playlistDto = Helpers.CreatePlaylistDto(folder.Id); | ||
JsonDataContractActionResult result = (JsonDataContractActionResult)PlaylistController.Create(playlistDto); | ||
PlaylistDto createdPlaylistDto = (PlaylistDto)result.Data; | ||
|
||
const int numItemsToCreate = 150; | ||
List<PlaylistItemDto> playlistItemDtos = Helpers.CreatePlaylistItemsDto(numItemsToCreate, createdPlaylistDto.Id); | ||
|
||
foreach (List<PlaylistItemDto> splitPlaylistItemDtos in Split(playlistItemDtos, 50)) | ||
{ | ||
PlaylistItemController.CreateMultiple(splitPlaylistItemDtos); | ||
} | ||
|
||
NHibernateSessionManager.Instance.Clear(); | ||
|
||
// Now delete the first playlist. | ||
PlaylistController.Delete(firstPlaylistId); | ||
} | ||
|
||
public static List<List<PlaylistItemDto>> Split(List<PlaylistItemDto> source, int splitSize) | ||
{ | ||
return source | ||
.Select((x, i) => new { Index = i, Value = x }) | ||
.GroupBy(x => x.Index / splitSize) | ||
.Select(x => x.Select(v => v.Value).ToList()) | ||
.ToList(); | ||
} | ||
|
||
[Test] | ||
public void CreatePlaylist_PlaylistDoesntExist_PlaylistCreated() | ||
{ | ||
PlaylistDto playlistDto = Helpers.CreatePlaylistDto(); | ||
|
||
JsonDataContractActionResult result = (JsonDataContractActionResult)PlaylistController.Create(playlistDto); | ||
|
||
PlaylistDto createdPlaylistDto = (PlaylistDto) result.Data; | ||
|
||
// Make sure we actually get a Playlist DTO back from the Controller. | ||
Assert.NotNull(createdPlaylistDto); | ||
|
||
NHibernateSessionManager.Instance.Clear(); | ||
|
||
Folder folder = FolderDao.Get(createdPlaylistDto.FolderId); | ||
|
||
// Make sure that the created playlist was cascade added to the Folder | ||
Assert.That(folder.Playlists.Count(p => p.Id == createdPlaylistDto.Id) == 1); | ||
} | ||
|
||
[Test] | ||
public void GetSharedPlaylist_PlaylistShareCodeExists_CopyOfPlaylistCreated() | ||
{ | ||
Folder folder = UserManager.CreateUser().Folders.First(); | ||
|
||
ShareCode shareCode = ShareCodeManager.GetShareCode(ShareableEntityType.Playlist, folder.Playlists.First().Id); | ||
|
||
JsonDataContractActionResult result = (JsonDataContractActionResult)PlaylistController.CreateCopyByShareCode(shareCode.ShortId, shareCode.UrlFriendlyEntityTitle, folder.Id); | ||
PlaylistDto playlistDto = (PlaylistDto) result.Data; | ||
|
||
// Make sure we actually get a Playlist DTO back from the Controller. | ||
Assert.NotNull(playlistDto); | ||
|
||
NHibernateSessionManager.Instance.Clear(); | ||
|
||
Folder folderFromDatabase = FolderDao.Get(playlistDto.FolderId); | ||
|
||
// Make sure that the created playlist was cascade added to the Folder | ||
Assert.That(folderFromDatabase.Playlists.Count(p => p.Id == playlistDto.Id) == 1); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.