-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+Fix: IsInitialised-Eigenschaften haben immer false zurückgegeben +User: SendFriendRequest bei User.System löst jetzt eine InvalidUserException aus
- Loading branch information
Showing
21 changed files
with
631 additions
and
28 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 |
---|---|---|
|
@@ -196,3 +196,4 @@ FakesAssemblies/ | |
*.opt | ||
Proxer.API.sln.GhostDoc.xml | ||
*.mrx | ||
Azuria.Test/Credentials.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
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,30 @@ | ||
using NUnit.Framework; | ||
using NUnit.Framework.Interfaces; | ||
|
||
namespace Azuria.Test.Attributes | ||
{ | ||
public class LoginRequiredAttribute : NUnitAttribute, ITestAction | ||
{ | ||
#region Geerbt | ||
|
||
/// <summary>Executed before each test is run</summary> | ||
/// <param name="test">The test that is going to be run.</param> | ||
public void BeforeTest(ITest test) | ||
{ | ||
if (!SenpaiTest.Senpai.IsLoggedIn) | ||
SenpaiTest.Senpai.Login(Credentials.Username, Credentials.Password).Wait(); | ||
} | ||
|
||
/// <summary>Executed after each test is run</summary> | ||
/// <param name="test">The test that has just been run.</param> | ||
public void AfterTest(ITest test) | ||
{ | ||
} | ||
|
||
/// <summary>Provides the target for the action attribute</summary> | ||
/// <returns>The target for the action attribute</returns> | ||
public ActionTargets Targets => ActionTargets.Default; | ||
|
||
#endregion | ||
} | ||
} |
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,103 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{2A122EA2-C3E1-488E-B1FA-0A1CC113DD6F}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Azuria.Test</RootNamespace> | ||
<AssemblyName>Azuria.Test</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="nunit.framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
</ItemGroup> | ||
</When> | ||
<Otherwise> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</Otherwise> | ||
</Choose> | ||
<ItemGroup> | ||
<Compile Include="Utility\ClassExtensions.cs" /> | ||
<Compile Include="Credentials.cs" /> | ||
<Compile Include="Attributes\LoginRequiredAttribute.cs" /> | ||
<Compile Include="ProxerClassTest.cs" /> | ||
<Compile Include="SenpaiTest.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="UserTest.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Azuria\Azuria.csproj"> | ||
<Project>{841dc1a7-9140-47e5-b13b-e4c57cfe6496}</Project> | ||
<Name>Azuria</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,39 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// Allgemeine Informationen über eine Assembly werden über folgende | ||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, | ||
// die einer Assembly zugeordnet sind. | ||
|
||
[assembly: AssemblyTitle("Azuria.Test")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Azuria.Test")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly | ||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von | ||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird | ||
|
||
[assembly: Guid("2a122ea2-c3e1-488e-b1fa-0a1cc113dd6f")] | ||
|
||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: | ||
// | ||
// Hauptversion | ||
// Nebenversion | ||
// Buildnummer | ||
// Revision | ||
// | ||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern | ||
// übernehmen, indem Sie "*" eingeben: | ||
// [Assembly: AssemblyVersion("1.0.*")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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,31 @@ | ||
using System.Threading.Tasks; | ||
using Azuria.Main; | ||
using Azuria.Test.Attributes; | ||
using Azuria.Utilities.ErrorHandling; | ||
using NUnit.Framework; | ||
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; | ||
|
||
namespace Azuria.Test | ||
{ | ||
[TestFixture, LoginRequired] | ||
public class ProxerClassTest | ||
{ | ||
[Test] | ||
public async Task GetAnimeMangaByIdTest() | ||
{ | ||
ProxerResult<IAnimeMangaObject> lValidAnimeResult = | ||
await ProxerClass.GetAnimeMangaById(8455, SenpaiTest.Senpai); | ||
ProxerResult<IAnimeMangaObject> lValidMangaResult = | ||
await ProxerClass.GetAnimeMangaById(7834, SenpaiTest.Senpai); | ||
ProxerResult<IAnimeMangaObject> lInvalidResult = await ProxerClass.GetAnimeMangaById(-1, SenpaiTest.Senpai); | ||
|
||
Assert.IsTrue(lValidAnimeResult.Success && lValidAnimeResult.Result != null); | ||
Assert.IsInstanceOfType(lValidAnimeResult.Result, typeof(Anime)); | ||
|
||
Assert.IsTrue(lValidMangaResult.Success && lValidMangaResult.Result != null); | ||
Assert.IsInstanceOfType(lValidMangaResult.Result, typeof(Manga)); | ||
|
||
Assert.IsFalse(lInvalidResult.Success); | ||
} | ||
} | ||
} |
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,121 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Azuria.Community; | ||
using Azuria.Exceptions; | ||
using Azuria.Notifications; | ||
using Azuria.Test.Utility; | ||
using Azuria.Utilities.ErrorHandling; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NUnit.Framework; | ||
using Assert = NUnit.Framework.Assert; | ||
|
||
namespace Azuria.Test | ||
{ | ||
[TestFixture] | ||
public class SenpaiTest | ||
{ | ||
public static Senpai Senpai = new Senpai(); | ||
|
||
[Test] | ||
public async Task CheckLoginTest() | ||
{ | ||
Senpai lNewSenpai = new Senpai(); | ||
PrivateObject lPrivateSenpai = new PrivateObject(lNewSenpai); | ||
ProxerResult<bool> lNotLoggedInResult = await (Task<ProxerResult<bool>>) lPrivateSenpai.Invoke("CheckLogin"); | ||
|
||
Assert.IsTrue(lNotLoggedInResult.Success); | ||
Assert.IsFalse(lNotLoggedInResult.Result); | ||
Assert.IsFalse(lNewSenpai.IsLoggedIn); | ||
} | ||
|
||
[Test] | ||
public async Task CheckNotificationsTest() | ||
{ | ||
PrivateObject lPrivateSenpai = new PrivateObject(Senpai); | ||
ProxerResult lNotLoggedInResult = await (Task<ProxerResult>) lPrivateSenpai.Invoke("CheckNotifications"); | ||
|
||
Assert.IsTrue(lNotLoggedInResult.Success); | ||
} | ||
|
||
[Test] | ||
public async Task ForcePropertyReloadTest() | ||
{ | ||
AnimeMangaUpdateCollection lAnimeMangaUpdateCollection = Senpai.AnimeMangaUpdates; | ||
FriendRequestCollection lFriendRequests = Senpai.FriendRequests; | ||
NewsCollection lNews = Senpai.News; | ||
PmCollection lPrivateMessageNotifications = Senpai.PrivateMessages; | ||
|
||
Assert.AreSame(lAnimeMangaUpdateCollection, Senpai.AnimeMangaUpdates); | ||
Assert.AreSame(lFriendRequests, Senpai.FriendRequests); | ||
Assert.AreSame(lNews, Senpai.News); | ||
Assert.AreSame(lPrivateMessageNotifications, Senpai.PrivateMessages); | ||
|
||
ProxerResult lPropertyReloadResult = await Senpai.ForcePropertyReload(); | ||
Assert.IsTrue(lPropertyReloadResult.Success); | ||
|
||
Assert.AreNotSame(lAnimeMangaUpdateCollection, Senpai.AnimeMangaUpdates); | ||
Assert.AreNotSame(lFriendRequests, Senpai.FriendRequests); | ||
Assert.AreNotSame(lNews, Senpai.News); | ||
Assert.AreNotSame(lPrivateMessageNotifications, Senpai.PrivateMessages); | ||
} | ||
|
||
[Test] | ||
public async Task GetConferencesTest() | ||
{ | ||
ProxerResult<IEnumerable<Conference>> lConferences = await Senpai.GetAllConferences(); | ||
|
||
Assert.IsTrue(lConferences.Success); | ||
Assert.IsNotNull(lConferences.Result); | ||
Assert.IsNotEmpty(lConferences.Result); | ||
} | ||
|
||
[Test] | ||
public void InitNotificationsTest() | ||
{ | ||
ProxerResult lValid = Senpai.InitNotifications(); | ||
ProxerResult lNotLoggedIn = new Senpai().InitNotifications(); | ||
|
||
Assert.IsTrue(lValid.Success); | ||
Assert.IsTrue(!lNotLoggedIn.Success && | ||
lNotLoggedIn.Exceptions.Any(exception => exception.GetType() == typeof(NotLoggedInException))); | ||
} | ||
|
||
[Test] | ||
public void LoginCookiesTest() | ||
{ | ||
CookieCollection lLoginCookies = Senpai.LoginCookies.GetCookies(new Uri("https://proxer.me")); | ||
Assert.IsFalse(lLoginCookies.ContainsCookie("device", "mobile")); | ||
} | ||
|
||
[Test, Order(1)] | ||
public async Task LoginTest() | ||
{ | ||
ProxerResult<bool> lValid = await Senpai.Login(Credentials.Username, Credentials.Password); | ||
ProxerResult<bool> lInvalidInput = await new Senpai().Login("", ""); | ||
ProxerResult<bool> lWrongCredentials = await new Senpai().Login("Test", "WrongPassword"); | ||
|
||
Assert.IsTrue(lValid.Success); | ||
Assert.IsTrue(lValid.Result); | ||
Assert.IsTrue(lInvalidInput.Success); | ||
Assert.IsFalse(lInvalidInput.Result); | ||
Assert.IsTrue(lWrongCredentials.Success); | ||
Assert.IsFalse(lWrongCredentials.Result); | ||
} | ||
|
||
[Test] | ||
public void MeTest() | ||
{ | ||
Assert.IsNotNull(Senpai.Me); | ||
} | ||
|
||
[Test] | ||
public void MobileCookiesTest() | ||
{ | ||
CookieCollection lMobileCookies = Senpai.MobileLoginCookies.GetCookies(new Uri("https://proxer.me")); | ||
Assert.IsTrue(lMobileCookies.ContainsCookie("device", "mobile")); | ||
} | ||
} | ||
} |
Oops, something went wrong.