-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df946d6
commit 9bae6e3
Showing
8 changed files
with
299 additions
and
24 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,97 @@ | ||
using BotLibraryV2; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using PlanB.Butler.Bot.Dialogs; | ||
using System; | ||
|
||
namespace PlanB.Butler.Bot.Test | ||
{ | ||
/// <summary> | ||
/// NextOrderTest. | ||
/// </summary> | ||
[TestClass] | ||
public class NextOrderTest | ||
{ | ||
/// <summary> | ||
/// The plan | ||
/// </summary> | ||
private Plan plan; | ||
private PlanDay planDay; | ||
private PlanDayMeal planDayMealLinsen; | ||
|
||
|
||
/// <summary> | ||
/// Initialize each test. | ||
/// </summary> | ||
[TestInitialize] | ||
public void Init() | ||
{ | ||
this.plan = new Plan(); | ||
this.planDay = new PlanDay() { Name = "Day1" }; | ||
this.planDayMealLinsen = new PlanDayMeal() | ||
{ | ||
Name = "Linsen", | ||
Price = 2.3, | ||
Restaurant = "LinsenWirt", | ||
}; | ||
this.planDay.Meal1 = new System.Collections.Generic.List<PlanDayMeal>(); | ||
this.planDay.Meal1.Add(this.planDayMealLinsen); | ||
this.plan.Planday = new System.Collections.Generic.List<PlanDay> | ||
{ | ||
this.planDay, | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// Plans the null identifier empty. | ||
/// </summary> | ||
[TestMethod] | ||
[ExpectedException(typeof(NullReferenceException))] | ||
public void PlanNullIdentifierEmpty() | ||
{ | ||
var result = NextOrder.GetChoice(string.Empty, this.plan); | ||
Assert.IsNotNull(result); | ||
} | ||
|
||
/// <summary> | ||
/// Plans the empty identifier empty. | ||
/// </summary> | ||
[TestMethod] | ||
[ExpectedException(typeof(NullReferenceException))] | ||
public void PlanEmptyIdentifierEmpty() | ||
{ | ||
this.plan = new Plan(); | ||
var result = NextOrder.GetChoice(string.Empty, this.plan); | ||
Assert.IsNotNull(result); | ||
} | ||
|
||
/// <summary> | ||
/// Plans the only name identifier empty. | ||
/// </summary> | ||
[TestMethod] | ||
public void PlanOnlyNameIdentifierEmpty() | ||
{ | ||
this.plan = new Plan(); | ||
var planDay = new PlanDay() { Name = "Day1" }; | ||
this.plan.Planday = new System.Collections.Generic.List<PlanDay> | ||
{ | ||
planDay, | ||
}; | ||
|
||
var result = NextOrder.GetChoice(string.Empty, this.plan); | ||
Assert.IsNotNull(result); | ||
Assert.AreEqual(0, result.Count); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Plans the one meal identifier empty. | ||
/// </summary> | ||
[TestMethod] | ||
public void PlanOneMealIdentifierEmpty() | ||
{ | ||
var result = NextOrder.GetChoice(string.Empty, this.plan); | ||
Assert.IsNotNull(result); | ||
Assert.AreEqual(0, result.Count); | ||
} | ||
} | ||
} |
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,42 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<Company>PlanB. GmbH</Company> | ||
<Product>PlanB Butler Bot</Product> | ||
<Authors>PlanB. GmbH</Authors> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<CodeAnalysisRuleSet /> | ||
<OutputPath>bin\Release\netcoreapp2.2\</OutputPath> | ||
<DocumentationFile>bin\Release\netcoreapp2.2\PlanB.Butler.Bot.Test.xml</DocumentationFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<CodeAnalysisRuleSet /> | ||
<OutputPath>bin\Debug\netcoreapp2.2\</OutputPath> | ||
<DocumentationFile>bin\Debug\netcoreapp2.2\PlanB.Butler.Bot.Test.xml</DocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Remove="StyleCop.Analyzers.ruleset" /> | ||
<None Remove="stylecop.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AdditionalFiles Include="StyleCop.Analyzers.ruleset" /> | ||
<AdditionalFiles Include="stylecop.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> | ||
<PackageReference Include="coverlet.collector" Version="1.2.0" /> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\PlanB.Butler.Bot\PlanB.Butler.Bot.csproj" /> | ||
</ItemGroup> | ||
|
||
</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,103 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="14.0"> | ||
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers"> | ||
<Rule Id="UseConfigureAwait" Action="Warning" /> | ||
</Rules> | ||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed"> | ||
<Rule Id="CA1001" Action="Warning" /> | ||
<Rule Id="CA1009" Action="Warning" /> | ||
<Rule Id="CA1016" Action="Warning" /> | ||
<Rule Id="CA1033" Action="Warning" /> | ||
<Rule Id="CA1049" Action="Warning" /> | ||
<Rule Id="CA1060" Action="Warning" /> | ||
<Rule Id="CA1061" Action="Warning" /> | ||
<Rule Id="CA1063" Action="Warning" /> | ||
<Rule Id="CA1065" Action="Warning" /> | ||
<Rule Id="CA1301" Action="Warning" /> | ||
<Rule Id="CA1400" Action="Warning" /> | ||
<Rule Id="CA1401" Action="Warning" /> | ||
<Rule Id="CA1403" Action="Warning" /> | ||
<Rule Id="CA1404" Action="Warning" /> | ||
<Rule Id="CA1405" Action="Warning" /> | ||
<Rule Id="CA1410" Action="Warning" /> | ||
<Rule Id="CA1415" Action="Warning" /> | ||
<Rule Id="CA1821" Action="Warning" /> | ||
<Rule Id="CA1900" Action="Warning" /> | ||
<Rule Id="CA1901" Action="Warning" /> | ||
<Rule Id="CA2002" Action="Warning" /> | ||
<Rule Id="CA2100" Action="Warning" /> | ||
<Rule Id="CA2101" Action="Warning" /> | ||
<Rule Id="CA2108" Action="Warning" /> | ||
<Rule Id="CA2111" Action="Warning" /> | ||
<Rule Id="CA2112" Action="Warning" /> | ||
<Rule Id="CA2114" Action="Warning" /> | ||
<Rule Id="CA2116" Action="Warning" /> | ||
<Rule Id="CA2117" Action="Warning" /> | ||
<Rule Id="CA2122" Action="Warning" /> | ||
<Rule Id="CA2123" Action="Warning" /> | ||
<Rule Id="CA2124" Action="Warning" /> | ||
<Rule Id="CA2126" Action="Warning" /> | ||
<Rule Id="CA2131" Action="Warning" /> | ||
<Rule Id="CA2132" Action="Warning" /> | ||
<Rule Id="CA2133" Action="Warning" /> | ||
<Rule Id="CA2134" Action="Warning" /> | ||
<Rule Id="CA2137" Action="Warning" /> | ||
<Rule Id="CA2138" Action="Warning" /> | ||
<Rule Id="CA2140" Action="Warning" /> | ||
<Rule Id="CA2141" Action="Warning" /> | ||
<Rule Id="CA2146" Action="Warning" /> | ||
<Rule Id="CA2147" Action="Warning" /> | ||
<Rule Id="CA2149" Action="Warning" /> | ||
<Rule Id="CA2200" Action="Warning" /> | ||
<Rule Id="CA2202" Action="Warning" /> | ||
<Rule Id="CA2207" Action="Warning" /> | ||
<Rule Id="CA2212" Action="Warning" /> | ||
<Rule Id="CA2213" Action="Warning" /> | ||
<Rule Id="CA2214" Action="Warning" /> | ||
<Rule Id="CA2216" Action="Warning" /> | ||
<Rule Id="CA2220" Action="Warning" /> | ||
<Rule Id="CA2229" Action="Warning" /> | ||
<Rule Id="CA2231" Action="Warning" /> | ||
<Rule Id="CA2232" Action="Warning" /> | ||
<Rule Id="CA2235" Action="Warning" /> | ||
<Rule Id="CA2236" Action="Warning" /> | ||
<Rule Id="CA2237" Action="Warning" /> | ||
<Rule Id="CA2238" Action="Warning" /> | ||
<Rule Id="CA2240" Action="Warning" /> | ||
<Rule Id="CA2241" Action="Warning" /> | ||
<Rule Id="CA2242" Action="Warning" /> | ||
</Rules> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Analyzers" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Analyzers"> | ||
<Rule Id="RS1022" Action="None" /> | ||
<!-- https://github.com/dotnet/roslyn-analyzers/issues/1803 --> | ||
</Rules> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.CodeStyle" RuleNamespace="Microsoft.CodeAnalysis.CSharp.CodeStyle"> | ||
<Rule Id="IDE0055" Action="Warning" /> | ||
</Rules> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features"> | ||
<Rule Id="IDE0003" Action="None" /> | ||
</Rules> | ||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> | ||
<Rule Id="SA1305" Action="Warning" /> | ||
<Rule Id="SA1412" Action="Warning" /> | ||
<Rule Id="SA1600" Action="None" /> | ||
<Rule Id="SA1633" Action="None" /> | ||
<Rule Id="SA1609" Action="Warning" /> | ||
</Rules> | ||
<Rules AnalyzerId="DocumentationAnalyzers" RuleNamespace="DocumentationAnalyzers"> | ||
<Rule Id="DOC100" Action="Warning" /> | ||
<Rule Id="DOC101" Action="Warning" /> | ||
<Rule Id="DOC102" Action="Warning" /> | ||
<Rule Id="DOC103" Action="Warning" /> | ||
<Rule Id="DOC104" Action="Warning" /> | ||
<Rule Id="DOC105" Action="Warning" /> | ||
<Rule Id="DOC106" Action="Warning" /> | ||
<Rule Id="DOC107" Action="Warning" /> | ||
<Rule Id="DOC108" Action="Warning" /> | ||
<Rule Id="DOC200" Action="Warning" /> | ||
<Rule Id="DOC201" Action="Warning" /> | ||
<Rule Id="DOC202" Action="Warning" /> | ||
<Rule Id="DOC203" Action="Warning" /> | ||
<Rule Id="DOC204" Action="Warning" /> | ||
</Rules> | ||
</RuleSet> |
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,43 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", | ||
"settings": { | ||
"indentation": { | ||
"indentationSize": 4, | ||
"tabSize": 4, | ||
"useTabs": false | ||
}, | ||
"spacingRules": { | ||
}, | ||
"readabilityRules": { | ||
}, | ||
"orderingRules": { | ||
"elementOrder": [ "kind", "accessibility", "constant", "static", "readonly" ], | ||
"systemUsingDirectivesFirst": true, | ||
"usingDirectivesPlacement": "outsideNamespace", | ||
"blankLinesBetweenUsingGroups": "require" | ||
}, | ||
"namingRules": { | ||
"allowCommonHungarianPrefixes": true, | ||
"allowedHungarianPrefixes": [] | ||
}, | ||
"maintainabilityRules": { | ||
"topLevelTypes": [ "class", "delegate", "enum", "interface", "struct" ] | ||
}, | ||
"layoutRules": { | ||
"newlineAtEndOfFile": "allow", | ||
"allowConsecutiveUsings": false | ||
}, | ||
"documentationRules": { | ||
"companyName": "PlanB. GmbH", | ||
"copyrightText": "Copyright (c) {companyName}. All Rights Reserved.\r\nLicensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.", | ||
"xmlHeader": false, | ||
"fileNamingConvention": "metadata", | ||
"documentInterfaces": true, | ||
"documentExposedElements": true, | ||
"documentInternalElements": true, | ||
"documentPrivateElements": true, | ||
"documentPrivateFields": true, | ||
"documentationCulture": "en-US" | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.