public async Task VerifyFormScript <T>(string filePath, string locale, BuildFormDelegate <T> buildForm, FormOptions options, T initialState, IEnumerable <EntityRecommendation> entities, params string[] inputs) where T : class { var newPath = Script.NewScriptPathFor(filePath); File.Delete(newPath); var currentState = JsonConvert.DeserializeObject <T>(JsonConvert.SerializeObject(initialState)); try { using (var stream = new StreamReader(filePath)) using (var container = Build(Options.Reflection)) { Func <IDialog <object> > makeRoot = () => new FormDialog <T>(currentState, buildForm, options, entities); Assert.AreEqual(locale, stream.ReadLine()); Assert.AreEqual(SerializeToJson(initialState), stream.ReadLine()); Assert.AreEqual(SerializeToJson(entities), stream.ReadLine()); await Script.VerifyScript(container, makeRoot, false, stream, (stack, state) => { var form = ((FormDialog <T>)stack.Frames[0].Target); Assert.AreEqual(state, SerializeToJson(form.State)); }, inputs, locale); } } catch (Exception) { // There was an error, so record new script and pass on error await RecordFormScript(newPath, locale, buildForm, options, initialState, entities, inputs); TestContext.AddResultFile(newPath); throw; } }
public LUISDialog(BuildFormDelegate <PersonalBanking> personalBanking) : base(new LuisService(new LuisModelAttribute( ConfigurationManager.AppSettings["LuisAppId"], ConfigurationManager.AppSettings["LuisAPIKey"], domain: ConfigurationManager.AppSettings["LuisAPIHostName"]))) { this.Banking = personalBanking; loan = new Loan(); }
internal static FormDialog <LeadRegisterForm> MakeRootDialog(string channelId) { BuildFormDelegate <LeadRegisterForm> MakeLeadRegisterForm = null; var isSkype = channelId.ToLowerInvariant() == "skypeforbusiness"; if (isSkype) { MakeLeadRegisterForm = () => LeadRegisterForm.BuildFormSkype(); } else { MakeLeadRegisterForm = () => LeadRegisterForm.BuildForm(); } return(FormDialog.FromForm(MakeLeadRegisterForm, options: FormOptions.PromptInStart)); }
public async Task RecordFormScript <T>(string filePath, string locale, BuildFormDelegate <T> buildForm, FormOptions options, T initialState, IEnumerable <EntityRecommendation> entities, params string[] inputs) where T : class { using (var stream = new StreamWriter(filePath)) using (var container = Build(Options.ResolveDialogFromContainer | Options.Reflection)) { var root = new FormDialog <T>(initialState, buildForm, options, entities, CultureInfo.GetCultureInfo(locale)); stream.WriteLine($"{locale}"); stream.WriteLine($"{SerializeToJson(initialState)}"); stream.WriteLine($"{SerializeToJson(entities)}"); var builder = new ContainerBuilder(); builder .RegisterInstance(root) .AsSelf() .As <IDialog <object> >(); builder.Update(container); await Script.RecordScript(container, false, stream, () => "State:" + SerializeToJson(initialState), inputs); } }
public async Task VerifyFormScript <T>(string filePath, string locale, BuildFormDelegate <T> buildForm, FormOptions options, T initialState, IEnumerable <EntityRecommendation> entities, params string[] inputs) where T : class { var newPath = Script.NewScriptPathFor(filePath); File.Delete(newPath); var currentState = JsonConvert.DeserializeObject <T>(JsonConvert.SerializeObject(initialState)); try { using (var stream = new StreamReader(filePath)) using (var container = Build(Options.ResolveDialogFromContainer | Options.Reflection)) { var root = new FormDialog <T>(currentState, buildForm, options, entities, CultureInfo.GetCultureInfo(locale)); var builder = new ContainerBuilder(); builder .RegisterInstance(root) .AsSelf() .As <IDialog <object> >(); builder.Update(container); Assert.AreEqual(locale, stream.ReadLine()); Assert.AreEqual(SerializeToJson(initialState), stream.ReadLine()); Assert.AreEqual(SerializeToJson(entities), stream.ReadLine()); await Script.VerifyScript(container, false, stream, (state) => Assert.AreEqual(state, SerializeToJson(currentState)), inputs); } } catch (Exception) { // There was an error, so record new script and pass on error await RecordFormScript(newPath, locale, buildForm, options, initialState, entities, inputs); TestContext.AddResultFile(newPath); throw; } }
public SoftwareRequestDialog(BuildFormDelegate <SoftwareRequest> newSoftwareRequest) { this._newSoftwareRequest = newSoftwareRequest; }
public LaptopFaultDialog(BuildFormDelegate <LaptopFault> newLaptopFault) { this._newLaptopFault = newLaptopFault; }
public SoftwareFaultDialog(BuildFormDelegate <SoftwareFault> newSoftwareFault) { this._newSoftwareFault = newSoftwareFault; }
public HotelBotLuisDialog(BuildFormDelegate <RoomReservation> reserveRoom) { this.ReserveRoom = reserveRoom; }
public LUISDialog(BuildFormDelegate <Order> newOrder) { this.NewOrder = newOrder; }
public RootDialog(BuildFormDelegate <BookingFlow> bookMeetingRoom, Func <IBotContext, IAwaitable <BookingFlow>, Task> onAfterBooking) { BookMeetingRoom = bookMeetingRoom; OnAfterBooking = onAfterBooking; }
public LuisDialog(BuildFormDelegate <ParcelTracking> parcelTrackingForm, ParcelService parcelService) { this.parcelTrackingForm = parcelTrackingForm; this.parcelService = parcelService; }
public LUISDialog(BuildFormDelegate <MessageBox> configureMessageBox) { _configureMessageBox = configureMessageBox; }
public AccessResetDialog(BuildFormDelegate <AccessReset> newAccessReset) { this._newAccessReset = newAccessReset; }
public AccessRequestDialog(BuildFormDelegate <AccessRequest> newAccessRequest) { this._newAccessRequest = newAccessRequest; }
internal InteractionWithLuis(BuildFormDelegate <Pedido> criarPedido) { this.CriarPedido = criarPedido; }
public HotelDialogLUIS(BuildFormDelegate <RoomReservation> ireserveRoom) { _reserveRoom = ireserveRoom; }
public static IFormDialog <T> MakeForm <T>(BuildFormDelegate <T> buildForm) where T : class, new() { return(new FormDialog <T>(new T(), buildForm, options: FormOptions.PromptInStart)); }
public RootDialog(BuildFormDelegate <Cakes> orderCake) { OrderCake = orderCake; }
internal LuisForm(BuildFormDelegate <Pedido> criarPedido) { CriarPedido = criarPedido; }
public LuisDialog(BuildFormDelegate <UserOrder> pizzaorder) { this.OrderPizza = pizzaorder; }
public PeripheralsRequestDialog(BuildFormDelegate <PeripheralsRequest> newPeripheralsRequest) { this._newPeripheralsRequest = newPeripheralsRequest; }
internal PizzaOrderDialog(BuildFormDelegate <PizzaOrder> makePizzaForm) { this.MakePizzaForm = makePizzaForm; }
/// <summary> /// Create an <see cref="IFormDialog{T}"/> using the <see cref="BuildFormDelegate{T}"/> parameter. /// </summary> /// <typeparam name="T">The form type.</typeparam> /// <param name="buildForm">The delegate to build the form.</param> /// <param name="options">The form options.</param> /// <returns>The form dialog.</returns> public static IFormDialog <T> FromForm <T>(BuildFormDelegate <T> buildForm, FormOptions options = FormOptions.None) where T : class, new() { return(new FormDialog <T>(new T(), buildForm, options)); }
public LUISDialog(BuildFormDelegate <UserFeedBack> UserFB) { this.UserFB = UserFB; }
public IncidentDialog(BuildFormDelegate <IncidenceReport> newIncidentReport) { this.newIncidentReport_ = newIncidentReport; }
public LuisDialog(BuildFormDelegate <RoomsReservation> reserveRoom) { this._reserveRoom = reserveRoom; }
public AutoNationLuisDialog(BuildFormDelegate <LeadForm> submitLeadForm, BuildFormDelegate <UserActivityType> submitActivityType) { SubmitLeadForm = submitLeadForm; SubmitActivityType = submitActivityType; }
public LUISDialog(BuildFormDelegate <RoomReservation> reserveRoom) { this.reserveform = reserveRoom; }
internal BatterySelectorDialog(BuildFormDelegate <BatterySelector> MakeBatteryForm) { this.MakeBatteryForm = MakeBatteryForm; }