public void CreateIdListFilter_Ids_FieldEquality() { var actual = MongoBotStateStore.CreateIdListFilter(new[] { "a", "b" }); var json = Render(actual).ToJson(); Assert.Equal("{ \"_id\" : { \"$in\" : [\"a\", \"b\"] } }", json); }
public void PackState_WithDocument_CreatesDictionaryEntry() { StoredState expected = new StoredState { State = "yo" }; var actual = MongoBotStateStore.PackState("a", expected); Assert.Same(expected.State, actual["a"]); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddNewtonsoftJson(); services.AddSingleton <IBotFrameworkHttpAdapter, ErrorLogginAdapter>(); // Create state store using the MongoDB storage component. var client = new MongoDB.Driver.MongoClient("mongodb://localhost/"); var storage = new MongoBotStateStore(new MongoStateStoreSettings(client)); services.AddSingleton(new UserState(storage)); services.AddSingleton(new ConversationState(storage)); services.AddTransient <IBot, StateManagementBot>(); }
public void CreateUpdateDefinition_Sets_Values() { var actual = MongoBotStateStore.CreateUpdateDefinition("yo"); Assert.Contains("{ \"$set\" : { \"State\" : \"yo\", \"Updated\" : ISODate(", Render(actual).ToJson()); }
public void PackState_NoDocument_EmptyDictionary() { var actual = MongoBotStateStore.PackState("a", null); Assert.Equal(0, actual.Count); }
public void CreateIdListFilter_Ids_CreatesFilter() { var actual = MongoBotStateStore.CreateIdListFilter(new[] { "a", "b" }); Assert.NotNull(actual); }