private static string ExpectedMessage( TestMatcherName matcherName, UserDataCollection data) { if (matcherName.IsInvariant) { return(""); } if (matcherName.IsAndOr) { return(matcherName.IsNegated ? SR.NotExpectedTo() : SR.ExpectedTo()); } var msgCode = matcherName.ToSRKey(); var msg = SR.ResourceManager.GetString(msgCode); if (msg == null) { return(MissingLocalization(msgCode)); } var fill = FillableMessage.Fill(msg, data); data.ExpectedConsumedInMessage = fill.Keys.Contains("Expected"); return(fill.ToString()); }
private async Task ChangeLanguage(WaterfallStepContext stepContext, RecognizerResult result) { string entity = result.Entities["Language"]?.First.ToString(); UserDataCollection userProfile = await userStateAccessor.GetAsync(stepContext.Context, () => new UserDataCollection()); Debug.WriteLine($"Language before {userProfile.language}"); Debug.WriteLine("entity " + entity); // user has specified which language they want to change to if (entity != null && entity.ToLower() == "arabic" || entity.ToLower() == "english") { userProfile.language = entity.ToLower(); } // user has not specified the language but intends to change language else { if (userProfile.language.ToLower() == "english") { userProfile.language = "arabic"; } else { userProfile.language = "english"; } } Debug.WriteLine("Saving"); await userStateAccessor.SetAsync(stepContext.Context, userProfile); }
/// <summary> /// /// </summary> public HitsList() { _hitItem = new BasicMenuItem(HitItemPosition); _menuPosition = new Vector2(0, 0); _userData = new UserDataCollection(); DeserializeHistory(); }
public void AddAchievementToUserSession(string achievement) { List <UserData> users = ReadUserDataCollection(file); UserData udata = null; List <UserData> tempUsers = new List <UserData>(users); string username = AppManager.instance.GetSessionName(); foreach (UserData user in tempUsers) { if (user.name == username) { udata = user; users.Remove(user); } } if (udata == null) { Debug.Log("User not found. User: " + username); return; } udata.achievements.Add(achievement); users.Add(udata); UserDataCollection save = new UserDataCollection(); save.users = users; SaveData(file, save); }
/// <summary> /// Creates an initial test state object. /// </summary> /// <param name="primaryTestStep">The primary test step.</param> /// <param name="testActions">The test actions.</param> /// <param name="converter">The converter for data binding.</param> /// <param name="formatter">The formatter for data binding.</param> /// <param name="isExplicit">True if the test was selected explicitly.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="primaryTestStep"/>, /// <paramref name="testActions"/>, <paramref name="converter"/> /// or <paramref name="formatter"/> is null.</exception> internal PatternTestState(PatternTestStep primaryTestStep, PatternTestActions testActions, IConverter converter, IFormatter formatter, bool isExplicit) { if (primaryTestStep == null) { throw new ArgumentNullException("primaryTestStep"); } if (testActions == null) { throw new ArgumentNullException("testActions"); } if (converter == null) { throw new ArgumentNullException("converter"); } if (formatter == null) { throw new ArgumentNullException("formatter"); } this.primaryTestStep = primaryTestStep; this.testActions = testActions; this.converter = converter; this.formatter = formatter; this.isExplicit = isExplicit; bindingContext = new DataBindingContext(converter); testParameterDataAccessors = new Dictionary <PatternTestParameter, IDataAccessor>(); data = new UserDataCollection(); }
public void AddGameDataToUser(string filename, string username, GameData data) { List <UserData> users = ReadUserDataCollection(filename); UserData udata = null; List <UserData> tempUsers = new List <UserData>(users); foreach (UserData user in tempUsers) { if (user.name == username) { udata = user; users.Remove(user); } } if (udata == null) { Debug.Log("User not found. User: " + username); return; } udata.record.Add(data); users.Add(udata); UserDataCollection save = new UserDataCollection(); save.users = users; SaveData(filename, save); }
public void NonExistantValuesCanBeRemovedWithoutSideEffects() { UserDataCollection collection = new UserDataCollection(); collection.RemoveValue(new Key <int>("key")); Assert.IsFalse(collection.HasValue(new Key <int>("key"))); }
private async Task <DialogTurnResult> StartDialogAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { // Create an object in which to collect the user's information within the dialog. UserDataCollection userProfile = await userStateAccessor.GetAsync(stepContext.Context, () => new UserDataCollection()); stepContext.Values["User"] = userProfile; await stepContext.Context.SendActivityAsync(MessageFactory.Text("مرحبا! أنا حكيم ، رفيق التعليم الافتراضي الخاص بك. من المثير أن تساعدك على اكتشاف وتعلم أشياء جديدة.")); var reply = MessageFactory.Text("Hi!I'm Hakeem, your virtual Learning Companion. It's exciting to help you discover and learn new things."); reply.SuggestedActions = new SuggestedActions() { Actions = new List <CardAction>() { new CardAction() { Title = "Continue in English", Type = ActionTypes.ImBack, Value = "English" }, new CardAction() { Title = "تواصل باللغة العربية ى", Type = ActionTypes.ImBack, Value = "عربى" }, } }; await stepContext.Context.SendActivityAsync(reply, cancellationToken); var promptOptions = new PromptOptions { }; return(await stepContext.PromptAsync("text", promptOptions, cancellationToken)); }
private async Task <DialogTurnResult> DisplayTopics(WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserDataCollection userProfile = await _userStateAccessor.GetAsync(stepContext.Context, () => new UserDataCollection()); stepContext.Values["SessionLang"] = userProfile.language; var reply = MessageFactory.Text(""); if (userProfile.language.ToLower() == "english") { await stepContext.Context.SendActivityAsync(MessageFactory.Text("Let's get to learning then!")); reply.Text = "Please select the subject that you want to explore."; List <dynamic> unique_topics = SaveConversationData.GetUniqueTopics(); List <CardAction> childSuggestions = new List <CardAction>(); foreach (string topic in unique_topics) { childSuggestions.Add(new CardAction() { Title = topic, Type = ActionTypes.ImBack, Value = topic }); } childSuggestions.Add(new CardAction() { Title = "Go Back", Type = ActionTypes.ImBack, Value = "Go Back" }); reply.SuggestedActions = new SuggestedActions() { Actions = childSuggestions }; } else { await stepContext.Context.SendActivityAsync(MessageFactory.Text(await Translate.Translator("Let's get to learning then!", "ar"))); reply.Text = await Translate.Translator("Please select the subject that you want to explore.", "ar"); List <dynamic> unique_topics = SaveConversationData.GetUniqueTopics(); List <CardAction> childSuggestions = new List <CardAction>(); foreach (string topic in unique_topics) { childSuggestions.Add(new CardAction() { Title = topic, Type = ActionTypes.ImBack, Value = topic }); } childSuggestions.Add(new CardAction() { Title = await Translate.Translator("Go Back", "ar"), Type = ActionTypes.ImBack, Value = await Translate.Translator("Go Back", "ar") }); reply.SuggestedActions = new SuggestedActions() { Actions = childSuggestions }; } await stepContext.Context.SendActivityAsync(reply); return(await stepContext.PromptAsync("text", new PromptOptions { }, cancellationToken)); }
private async Task <DialogTurnResult> GetIntent(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var recognizer = new LuisRecognizer(luisApplication); var recognizerResult = await recognizer.RecognizeAsync(stepContext.Context, cancellationToken); var(intent, score) = recognizerResult.GetTopScoringIntent(); Debug.WriteLine($"intent {intent}"); switch (intent) { case "command": await CommandIntent(stepContext); break; case "Question": await QuestionIntent(stepContext); break; case "learning": string entity = recognizerResult.Entities["subject"]?.First.ToString(); AddDialog(new LearningDialog(userState, entity)); return(await stepContext.ReplaceDialogAsync(nameof(LearningDialog))); case "suggestion": AddDialog(new RecommendDialog(userState)); return(await stepContext.ReplaceDialogAsync(nameof(RecommendDialog))); case "Preferences": AddDialog(new EditPreferences(userState)); return(await stepContext.ReplaceDialogAsync(nameof(EditPreferences))); case "Restart": AddDialog(new LearningDialog(userState, null)); return(await stepContext.ReplaceDialogAsync(nameof(LearningDialog))); case "ChangeLanguage": await ChangeLanguage(stepContext, recognizerResult); break; case "None": case "Gibberish": await stepContext.Context.SendActivityAsync(MessageFactory.Text("Sorry I understand that!")); break; default: AddDialog(new LearningDialog(userState, null)); return(await stepContext.ReplaceDialogAsync(nameof(LearningDialog))); } AddDialog(new LearningDialog(userState, null)); UserDataCollection userProfile = await userStateAccessor.GetAsync(stepContext.Context, () => new UserDataCollection()); Debug.WriteLine($"Language after {userProfile.language}"); return(await stepContext.ReplaceDialogAsync(nameof(LearningDialog))); }
public void ExistingValuesCanBeRemoved() { UserDataCollection collection = new UserDataCollection(); collection.SetValue(new Key <int>("key"), 123); Assert.IsTrue(collection.HasValue(new Key <int>("key"))); collection.RemoveValue(new Key <int>("key")); Assert.IsFalse(collection.HasValue(new Key <int>("key"))); }
public void NonExistantValuesCannotBeRetrieved() { UserDataCollection collection = new UserDataCollection(); Assert.IsFalse(collection.HasValue(new Key<int>("key"))); int value; Assert.IsFalse(collection.TryGetValue(new Key<int>("key"), out value)); Assert.AreEqual(0, value); Assert.Throws<KeyNotFoundException>(delegate { collection.GetValue(new Key<int>("key"));}); Assert.AreEqual(42, collection.GetValueOrDefault(new Key<int>("key"), 42)); }
private string[] Render(UserDataCollection ud) { var console = new TestConsole(); var context = new RenderContext { Parts = new ConsoleOutputParts(new TestRunnerOptions()), Console = console }; new ConsoleUserData().Render(context, ud); return(console.NonBlankLines.ToArray()); }
public void Fill_should_apply_format_strings() { var dict = new UserDataCollection { { "BoundsExclusive", "true" }, }; Assert.Equal( "hello (exclusive)", FillableMessage.Fill("hello {BoundsExclusive:B:(exclusive)}", dict).ToString() ); }
public void CanCopyAnEmptyCollection() { UserDataCollection source = new UserDataCollection(); UserDataCollection copy = source.Copy(); Assert.IsFalse(copy.HasValue(new Key<int>("key"))); copy.SetValue(new Key<int>("key"), 33); Assert.AreEqual(33, copy.GetValue(new Key<int>("key"))); Assert.IsFalse(source.HasValue(new Key<int>("key"))); }
private async Task <DialogTurnResult> ProcessGender(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var result = (FoundChoice)stepContext.Result; string gender = result.Value; UserDataCollection userProfile = (UserDataCollection)stepContext.Values["User"]; userProfile.gender = gender; return(await stepContext.NextAsync()); }
private async Task <DialogTurnResult> HowAreYou(WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserDataCollection user = (UserDataCollection)stepContext.Result; // var userStateAccessors = userState.CreateProperty<UserDataCollection>(nameof(UserDataCollection)); // var userProfile = await userStateAccessors.GetAsync(stepContext.Context, () => new UserDataCollection()); PromptOptions promptOption = new PromptOptions { Prompt = MessageFactory.Text("Hello " + user.Name + ", how are you today?") }; return(await stepContext.PromptAsync("text", promptOption)); }
public void ExistingValuesCanBeRetrieved() { UserDataCollection collection = new UserDataCollection(); collection.SetValue(new Key<int>("key"), 123); Assert.IsTrue(collection.HasValue(new Key<int>("key"))); Assert.AreEqual(123, collection.GetValue(new Key<int>("key"))); Assert.AreEqual(123, collection.GetValueOrDefault(new Key<int>("key"), 0)); int value; Assert.IsTrue(collection.TryGetValue(new Key<int>("key"), out value)); Assert.AreEqual(123, value); }
public void Start() { input_name = GetComponentInChildren <TMP_InputField>(); list = DataManager.instance.ReadUserDataCollection("users"); collection = new UserDataCollection(); if (list.Count == 0) { list = new List <UserData>(); } }
public void NonExistantValuesCannotBeRetrieved() { UserDataCollection collection = new UserDataCollection(); Assert.IsFalse(collection.HasValue(new Key <int>("key"))); int value; Assert.IsFalse(collection.TryGetValue(new Key <int>("key"), out value)); Assert.AreEqual(0, value); Assert.Throws <KeyNotFoundException>(delegate { collection.GetValue(new Key <int>("key")); }); Assert.AreEqual(42, collection.GetValueOrDefault(new Key <int>("key"), 42)); }
public void CanCopyAnEmptyCollection() { UserDataCollection source = new UserDataCollection(); UserDataCollection copy = source.Copy(); Assert.IsFalse(copy.HasValue(new Key <int>("key"))); copy.SetValue(new Key <int>("key"), 33); Assert.AreEqual(33, copy.GetValue(new Key <int>("key"))); Assert.IsFalse(source.HasValue(new Key <int>("key"))); }
public void CanCopyANonEmptyCollection() { UserDataCollection source = new UserDataCollection(); source.SetValue(new Key<int>("key"), 42); UserDataCollection copy = source.Copy(); Assert.AreEqual(42, copy.GetValue(new Key<int>("key"))); copy.SetValue(new Key<int>("key"), 33); Assert.AreEqual(33, copy.GetValue(new Key<int>("key"))); Assert.AreEqual(42, source.GetValue(new Key<int>("key"))); }
public void LoadUserData() { if (!File.Exists(_databasePath)) { _userData = new UserDataCollection(); SaveUserData(); return; } string json = File.ReadAllText(_databasePath); _userData = JsonSerializer.Deserialize <UserDataCollection>(json, _jsonOptions); }
public void ExistingValuesCanBeRetrieved() { UserDataCollection collection = new UserDataCollection(); collection.SetValue(new Key <int>("key"), 123); Assert.IsTrue(collection.HasValue(new Key <int>("key"))); Assert.AreEqual(123, collection.GetValue(new Key <int>("key"))); Assert.AreEqual(123, collection.GetValueOrDefault(new Key <int>("key"), 0)); int value; Assert.IsTrue(collection.TryGetValue(new Key <int>("key"), out value)); Assert.AreEqual(123, value); }
public static UserDataItem GetUserDataItem(int id) { UserDataItem item = null; DataProvider.ExecuteCmd(GetConnection, "dbo.UserData_SelectById" , inputParamMapper : delegate(SqlParameterCollection UserDataCollection) { UserDataCollection.AddWithValue("@Id", id); }, map : delegate(IDataReader reader, short set) { item = MapUserData(reader); }); return(item); }
public void CanCopyANonEmptyCollection() { UserDataCollection source = new UserDataCollection(); source.SetValue(new Key <int>("key"), 42); UserDataCollection copy = source.Copy(); Assert.AreEqual(42, copy.GetValue(new Key <int>("key"))); copy.SetValue(new Key <int>("key"), 33); Assert.AreEqual(33, copy.GetValue(new Key <int>("key"))); Assert.AreEqual(42, source.GetValue(new Key <int>("key"))); }
public void Render_should_display_type_when_actuals_vary_only_by_type() { var ud = new UserDataCollection { { "Expected", "123" }, { "Actual", 123 }, }; Assert.Equal( new [] { " Actual: 123 (Int32)", " Expected: 123 (string)", }, Render(ud) ); }
public void Render_should_ignore_Expected_when_it_is_consumed() { var ud = new UserDataCollection { ExpectedConsumedInMessage = true, ["Expected"] = "not here", ["Actual"] = "Text of A", }; Assert.Equal( new [] { " Actual: Text of A" }, Render(ud) ); }
public void UserSessionCompleteTutorial(string tutorialname) { string session = AppManager.instance.GetSessionName(); List <UserData> users = ReadUserDataCollection(file); UserData udata = null; List <UserData> tempUsers = new List <UserData>(users); foreach (UserData user in tempUsers) { if (user.name == session) { udata = user; users.Remove(user); } } if (udata == null) { Debug.Log("User not found. User: "******"game": udata.gametutorial = true; break; case "achievements": udata.achievementstutorial = true; break; case "collectibles": udata.collectiblestutorial = true; break; default: Debug.Log("Tutorial " + tutorialname + " not existing."); break; } users.Add(udata); Debug.Log(udata); UserDataCollection save = new UserDataCollection(); save.users = users; SaveData(file, save); }
private async Task <DialogTurnResult> DisplayCommands(WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserDataCollection userProfile = await _userStateAccessor.GetAsync(stepContext.Context, () => new UserDataCollection()); Debug.WriteLine("name " + userProfile.Name); Debug.WriteLine("gender " + userProfile.gender); await stepContext.Context.SendActivityAsync(MessageFactory.Text("You can switch between English and Arabic at any time by simply sending your message in the language you want to use.")); await stepContext.Context.SendActivityAsync(MessageFactory.Text("Before we get started, take a second to learn about what I can do. You can also type “Commands” at any time to view other commands you can use.")); List <Choice> suggested = new List <Choice>(); suggested.Add(new Choice { Value = "About" }); suggested.Add(new Choice { Value = "Commands" }); suggested.Add(new Choice { Value = "Preferences" }); var reply = MessageFactory.SuggestedActions(new List <CardAction> { new CardAction() { Title = "About Hakeem", Type = ActionTypes.ImBack, Value = "About" }, new CardAction() { Title = "Commands", Type = ActionTypes.ImBack, Value = "Commands" }, new CardAction() { Title = "My Preferences", Type = ActionTypes.ImBack, Value = "Preferences" }, new CardAction() { Title = "Begin Learning", Type = ActionTypes.ImBack, Value = "Continue" }, }); await stepContext.Context.SendActivityAsync(reply); PromptOptions promptOptions = new PromptOptions { }; return(await stepContext.PromptAsync("text", promptOptions)); }
public void Render_should_display_type_when_matcher_requires_type() { var ud = new UserDataCollection { { "Expected", "123" }, { "Actual", "123" }, { "_ShowActualTypes", true }, }; Assert.Equal( new [] { " Actual: 123 (string)", " Expected: 123 (string)", }, Render(ud) ); }
private async Task <DialogTurnResult> ProcessName(WaterfallStepContext stepContext, CancellationToken cancellationToken) { await stepContext.Context.SendActivityAsync(MessageFactory.Text("Ok thanks! Now the boring stuff is out of the way we can get on to the good stuff!")); UserDataCollection userProfile = (UserDataCollection)stepContext.Values["User"]; string answer = (string)stepContext.Result; userProfile.Name = answer; await SaveConversationData.SaveNewUser(stepContext.Context.Activity.From.Id, userProfile); await userStateAccessor.SetAsync(stepContext.Context, userProfile); AddDialog(new HowAreYou(userState)); Debug.WriteLine("Sending to how"); return(await stepContext.ReplaceDialogAsync(nameof(HowAreYou))); }
internal static void AddConstraint(ISpecificationConstraint constraint) { UserDataCollection data = Context.CurrentContext.Data; lock (data) { List <ISpecificationConstraint> constraints = data.GetValue <List <ISpecificationConstraint> >(ConstraintsKey); if (constraints == null) { constraints = new List <ISpecificationConstraint>(); data.SetValue(ConstraintsKey, constraints); } constraints.Add(constraint); } }
private async Task <DialogTurnResult> GenderPrompt(WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserDataCollection user = (UserDataCollection)stepContext.Values["User"]; string language = user.language; List <string> options = new List <string>(); options.Add("Male"); options.Add("Female"); options.Add("Prefer not say"); PromptOptions prompt = new PromptOptions { Prompt = MessageFactory.Text("For the Arabic language it is important I talk to you in the correct gender/nSo what gender would you like me to address you as?"), Choices = ChoiceFactory.ToChoices(options), RetryPrompt = MessageFactory.Text("Sorry that wasn't one of the options, please try again") }; return(await stepContext.PromptAsync(nameof(ChoicePrompt), prompt)); }
/// <summary> /// /// </summary> private void DeserializeHistory() { string path = System.Environment.CurrentDirectory + PATH; try { FileInfo file = new FileInfo(path); // If file doesn't exists, create new empty one. if (!file.Exists) { XmlSerializer l = new XmlSerializer(typeof(UserDataCollection)); TextWriter k = new StreamWriter(path); l.Serialize(k, new UserDataCollection()); k.Close(); } // Read file, if exsts (already exists =) ). if (file.Exists) { XmlSerializer s = new XmlSerializer(typeof(UserDataCollection)); TextReader r = new StreamReader(path); _userData = (UserDataCollection)s.Deserialize(r); r.Close(); _ValidateAndFixUserData(); } } catch (Exception) { // To logger } }
/// <summary> /// Creates an initial test state object. /// </summary> /// <param name="primaryTestStep">The primary test step.</param> /// <param name="testActions">The test actions.</param> /// <param name="converter">The converter for data binding.</param> /// <param name="formatter">The formatter for data binding.</param> /// <param name="isExplicit">True if the test was selected explicitly.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="primaryTestStep"/>, /// <paramref name="testActions"/>, <paramref name="converter"/> /// or <paramref name="formatter"/> is null.</exception> internal PatternTestState(PatternTestStep primaryTestStep, PatternTestActions testActions, IConverter converter, IFormatter formatter, bool isExplicit) { if (primaryTestStep == null) throw new ArgumentNullException("primaryTestStep"); if (testActions == null) throw new ArgumentNullException("testActions"); if (converter == null) throw new ArgumentNullException("converter"); if (formatter == null) throw new ArgumentNullException("formatter"); this.primaryTestStep = primaryTestStep; this.testActions = testActions; this.converter = converter; this.formatter = formatter; this.isExplicit = isExplicit; bindingContext = new DataBindingContext(converter); testParameterDataAccessors = new Dictionary<PatternTestParameter, IDataAccessor>(); data = new UserDataCollection(); }
/// <summary> /// Default constructor. /// </summary> public Particle() { _userData = new UserDataCollection(); Position = Vector2.Zero; Color = Vector4.One; }
/// <summary> /// Creates an initial test instance state object. /// </summary> /// <param name="testStep">The test step used to execute the test instance.</param> /// <param name="testInstanceActions">The test instance actions.</param> /// <param name="testState">The test state.</param> /// <param name="bindingItem">The data item.</param> /// <param name="body">The body of the test instance.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="testStep"/>, /// <paramref name="testInstanceActions"/> or <paramref name="testState"/> or <paramref name="bindingItem"/> is null.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="testState"/> belongs to a /// different test from the <paramref name="testStep"/>.</exception> internal PatternTestInstanceState(PatternTestStep testStep, PatternTestInstanceActions testInstanceActions, PatternTestState testState, IDataItem bindingItem, TestAction body) { if (testStep == null) throw new ArgumentNullException("testStep"); if (testInstanceActions == null) throw new ArgumentNullException("testInstanceActions"); if (testState == null) throw new ArgumentNullException("testState"); if (testStep.Test != testState.Test) throw new ArgumentException("The test state belongs to a different test from the test step.", "testState"); if (bindingItem == null) throw new ArgumentNullException("bindingItem"); if (body == null) throw new ArgumentNullException("body"); this.testStep = testStep; this.testInstanceActions = testInstanceActions; this.testState = testState; this.bindingItem = bindingItem; this.body = body; testParameterValues = new Dictionary<PatternTestParameter, object>(); slotValues = new Dictionary<ISlotInfo, object>(); data = new UserDataCollection(); nameBase = testStep.Name; nameSuffixes = string.Empty; }
/// <summary> /// Creates a stub context. /// </summary> public StubTestContext() { data = new UserDataCollection(); testStep = new TestStep(new RootTest(), null); logWriter = new TextualMarkupDocumentWriter(Console.Out, false); }
public void NonExistantValuesCanBeRemovedWithoutSideEffects() { UserDataCollection collection = new UserDataCollection(); collection.RemoveValue(new Key<int>("key")); Assert.IsFalse(collection.HasValue(new Key<int>("key"))); }
public void ExistingValuesCanBeRemoved() { UserDataCollection collection = new UserDataCollection(); collection.SetValue(new Key<int>("key"), 123); Assert.IsTrue(collection.HasValue(new Key<int>("key"))); collection.RemoveValue(new Key<int>("key")); Assert.IsFalse(collection.HasValue(new Key<int>("key"))); }
/// <summary> /// Creates an observable test context. /// </summary> /// <param name="manager">The test context manager.</param> /// <param name="testStep">The test step.</param> /// <param name="parent">The parent test context.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="manager"/> or <paramref name="testStep"/> is null.</exception> public ObservableTestContext(ObservableTestContextManager manager, TestStep testStep, ITestContext parent) { if (manager == null) throw new ArgumentNullException("manager"); if (testStep == null) throw new ArgumentNullException("testStep"); this.manager = manager; this.testStep = testStep; this.parent = parent; logWriter = new ObservableTestLogWriter(MessageSink, testStep.Id); externallyVisibleLogWriter = new FallbackMarkupDocumentWriter(logWriter, parent != null ? parent.LogWriter : new NullMarkupDocumentWriter()); data = new UserDataCollection(); }