示例#1
0
        public void CreateIdListFilter_Ids_FieldEquality()
        {
            var actual = MongoBotStateStore.CreateIdListFilter(new[] { "a", "b" });
            var json   = Render(actual).ToJson();

            Assert.Equal("{ \"_id\" : { \"$in\" : [\"a\", \"b\"] } }", json);
        }
示例#2
0
        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>();
        }
示例#4
0
        public void CreateUpdateDefinition_Sets_Values()
        {
            var actual = MongoBotStateStore.CreateUpdateDefinition("yo");

            Assert.Contains("{ \"$set\" : { \"State\" : \"yo\", \"Updated\" : ISODate(", Render(actual).ToJson());
        }
示例#5
0
        public void PackState_NoDocument_EmptyDictionary()
        {
            var actual = MongoBotStateStore.PackState("a", null);

            Assert.Equal(0, actual.Count);
        }
示例#6
0
        public void CreateIdListFilter_Ids_CreatesFilter()
        {
            var actual = MongoBotStateStore.CreateIdListFilter(new[] { "a", "b" });

            Assert.NotNull(actual);
        }