Skip to content

Commit

Permalink
Formflow: Bring tests back to life. Still 2 failing but all others pa…
Browse files Browse the repository at this point in the history
…ssing and form test program working end to end. (#4742)
  • Loading branch information
carlosscastro authored Jun 14, 2018
1 parent 81232b0 commit fdc73d8
Show file tree
Hide file tree
Showing 11 changed files with 786 additions and 8 deletions.
11 changes: 10 additions & 1 deletion CSharp/Microsoft.Bot.Builder.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
VisualStudioVersion = 15.0.27004.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{28BCEB2C-F4BE-416D-A4FD-A311E99A9EB5}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -62,6 +62,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Bot.Sample.FormFl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoBot", "EchoBot\EchoBot.csproj", "{BC07AED8-F885-4810-8C41-66C05D4C1EAD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormTest", "Tests\FormTest\FormTest.csproj", "{77BD8C61-FB06-4BF7-A346-D2C87284390A}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Library\Microsoft.Bot.Connector.Shared\Microsoft.Bot.Connector.Shared.projitems*{09c14ef5-f94a-480f-82ca-4d934a977c7f}*SharedItemsImports = 4
Expand Down Expand Up @@ -174,6 +176,12 @@ Global
{BC07AED8-F885-4810-8C41-66C05D4C1EAD}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{BC07AED8-F885-4810-8C41-66C05D4C1EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC07AED8-F885-4810-8C41-66C05D4C1EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Documentation|Any CPU.Build.0 = Debug|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77BD8C61-FB06-4BF7-A346-D2C87284390A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -197,6 +205,7 @@ Global
{09C14EF5-F94A-480F-82CA-4D934A977C7F} = {28BCEB2C-F4BE-416D-A4FD-A311E99A9EB5}
{48E4B834-49A5-48EB-BBA7-20A7CD9690D2} = {8E05398E-3CBE-4DCD-9382-072DC8859427}
{BC07AED8-F885-4810-8C41-66C05D4C1EAD} = {8E05398E-3CBE-4DCD-9382-072DC8859427}
{77BD8C61-FB06-4BF7-A346-D2C87284390A} = {8E05398E-3CBE-4DCD-9382-072DC8859427}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F82D70DE-DC3B-4B04-97CD-3CFF66345798}
Expand Down
6 changes: 6 additions & 0 deletions CSharp/Tests/FormTest/FormTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\AnnotatedSandwichOrder.cs" />
<Compile Include="Models\SandwichOrder.cs" />
<Compile Include="pizza.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -112,6 +114,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>DynamicPizza.resx</DependentUpon>
</Compile>
<Compile Include="Resource\DynamicSandwich.Designer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down Expand Up @@ -142,6 +145,9 @@
<ItemGroup>
<EmbeddedResource Include="Resource\DynamicPizza.en.resx" />
<EmbeddedResource Include="Resource\DynamicPizza.fr.resx" />
<EmbeddedResource Include="Resource\DynamicSandwich.en.resx" />
<EmbeddedResource Include="Resource\DynamicSandwich.fr.resx" />
<EmbeddedResource Include="Resource\DynamicSandwich.resx" />
<EmbeddedResource Include="Resource\Microsoft.Bot.Builder.FormFlowTest.PizzaOrder.en.resx" />
<EmbeddedResource Include="Resource\Microsoft.Bot.Builder.FormFlowTest.PizzaOrder.fr.resx" />
<EmbeddedResource Include="Resource\Microsoft.Bot.Builder.FormFlowTest.PizzaOrder.resx" />
Expand Down
379 changes: 379 additions & 0 deletions CSharp/Tests/FormTest/Models/AnnotatedSandwichOrder.cs

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions CSharp/Tests/FormTest/Models/SandwichOrder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Builder SDK GitHub:
// https://github.com/Microsoft/BotBuilder
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

using Microsoft.Bot.Builder.FormFlow;
using System;
using System.Collections.Generic;

namespace FormTest.Models.SimpleSandwich
{
public enum SandwichOptions
{
BLT, BlackForestHam, BuffaloChicken, ChickenAndBaconRanchMelt, ColdCutCombo, MeatballMarinara,
OvenRoastedChicken, RoastBeef, RotisserieStyleChicken, SpicyItalian, SteakAndCheese, SweetOnionTeriyaki, Tuna,
TurkeyBreast, Veggie
};
public enum LengthOptions { SixInch, FootLong };
public enum BreadOptions { NineGrainWheat, NineGrainHoneyOat, Italian, ItalianHerbsAndCheese, Flatbread };
public enum CheeseOptions { American, MontereyCheddar, Pepperjack };
public enum ToppingOptions
{
Avocado, BananaPeppers, Cucumbers, GreenBellPeppers, Jalapenos,
Lettuce, Olives, Pickles, RedOnion, Spinach, Tomatoes
};
public enum SauceOptions
{
ChipotleSouthwest, HoneyMustard, LightMayonnaise, RegularMayonnaise,
Mustard, Oil, Pepper, Ranch, SweetOnion, Vinegar
};

[Serializable]
public class SandwichOrder
{
public SandwichOptions? Sandwich;
public LengthOptions? Length;
public BreadOptions? Bread;
public CheeseOptions? Cheese;
public List<ToppingOptions> Toppings;
public List<SauceOptions> Sauce;

public static IForm<SandwichOrder> BuildForm()
{
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the simple sandwich order bot!")
.Build();
}
};
}
9 changes: 3 additions & 6 deletions CSharp/Tests/FormTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
using Microsoft.Bot.Builder.FormFlow.Advanced;
using Microsoft.Bot.Connector;
using Microsoft.Bot.Builder.History;

using AnnotatedSandwichOrder = Microsoft.Bot.Sample.AnnotatedSandwichBot.SandwichOrder;
using SimpleSandwichOrder = Microsoft.Bot.Sample.SimpleSandwichBot.SandwichOrder;
using System.Resources;
using System.Text;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -284,11 +281,11 @@ static void Main(string[] args)
return MakeForm(() => PizzaOrder.BuildForm(false, false, true));
}
case DebugOptions.SimpleSandwichBot:
return MakeForm(() => SimpleSandwichOrder.BuildForm());
return MakeForm(() => FormTest.Models.SimpleSandwich.SandwichOrder.BuildForm());
case DebugOptions.AnnotatedSandwichBot:
return MakeForm(() => AnnotatedSandwichOrder.BuildLocalizedForm());
return MakeForm(() => FormTest.Models.AnnotatedSandwich.AnnotatedSandwichOrder.BuildLocalizedForm());
case DebugOptions.JSONSandwichBot:
return MakeForm(() => AnnotatedSandwichOrder.BuildJsonForm());
return MakeForm(() => FormTest.Models.AnnotatedSandwich.AnnotatedSandwichOrder.BuildJsonForm());
default:
throw new NotImplementedException();
}
Expand Down
108 changes: 108 additions & 0 deletions CSharp/Tests/FormTest/Resource/DynamicSandwich.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions CSharp/Tests/FormTest/Resource/DynamicSandwich.en.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BadAddress" xml:space="preserve">
<value>Address must start with a number.</value>
</data>
<data name="Cost" xml:space="preserve">
<value>Total for your sandwich is {0:C2} is that ok?</value>
</data>
<data name="FreeCookie" xml:space="preserve">
<value>Free cookie</value>
</data>
<data name="FreeDrink" xml:space="preserve">
<value>Free drink</value>
</data>
<data name="Processing" xml:space="preserve">
<value>We are currently processing your sandwich. We will message you the status.</value>
</data>
</root>
30 changes: 30 additions & 0 deletions CSharp/Tests/FormTest/Resource/DynamicSandwich.fr.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BadAddress" xml:space="preserve">
<value>Adresse doit commencer par un nombre.</value>
</data>
<data name="Cost" xml:space="preserve">
<value>Total pour votre "sandwich" est {0:C2} est ce correct?</value>
</data>
<data name="FreeCookie" xml:space="preserve">
<value>Cookie gratuit</value>
</data>
<data name="FreeDrink" xml:space="preserve">
<value>Boisson gratuite</value>
</data>
<data name="Processing" xml:space="preserve">
<value>Nous traitons actuellement votre "sandwich". Nous seront vous message le statut.</value>
</data>
</root>
Loading

0 comments on commit fdc73d8

Please sign in to comment.