コード例 #1
0
        public void Can_add_new_log_types_when_installing_a_provider()
        {
            // setup
            var testLogTypes = GetTestActivityLogTypes();
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider);

            // assert
            var databaseLogTypes = _container.Resolve<MongoCollection<ActivityLogType>>().FindAll().ToList();
            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes.SequenceEqual(testLogTypes, this.GetActivityLogTypeComparer()).ShouldBeTrue();
        }
コード例 #2
0
        public void Can_add_new_log_types_when_installing_a_provider()
        {
            // setup
            var testLogTypes        = GetTestActivityLogTypes();
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider);

            // assert
            var databaseLogTypes = _container.Resolve <MongoCollection <ActivityLogType> >().FindAll().ToList();

            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes.SequenceEqual(testLogTypes, this.GetActivityLogTypeComparer()).ShouldBeTrue();
        }
コード例 #3
0
        public void Can_update_existing_log_types_when_reinstalling_a_provider()
        {
            // setup
            Can_add_new_log_types_when_installing_a_provider();
            var testLogTypes = GetTestActivityLogTypes();

            testLogTypes[0].Name = "LogType1Modified";
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider, true);

            // assert
            var databaseLogTypes = _container.Resolve <MongoCollection <ActivityLogType> >().FindAll().ToList();

            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes[0].Name.ShouldEqual("LogType2");
            databaseLogTypes[1].Name.ShouldEqual("LogType1Modified");
        }
コード例 #4
0
        public void Can_ignore_already_installed_providers()
        {
            // setup
            Can_add_new_log_types_when_installing_a_provider();
            var testLogTypes = GetTestActivityLogTypes();

            testLogTypes[0].Name = "LogType1Modified";
            testLogTypes.Add(new ActivityLogType {
                Name = "LogType3", SystemKeyword = "LogType3System"
            });
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider);

            // assert
            var databaseLogTypes = _container.Resolve <MongoCollection <ActivityLogType> >().FindAll().ToList();

            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes[0].Name.ShouldEqual("LogType1");
        }
コード例 #5
0
        public void Can_update_existing_log_types_when_reinstalling_a_provider()
        {
            // setup
            Can_add_new_log_types_when_installing_a_provider();
            var testLogTypes = GetTestActivityLogTypes();
            testLogTypes[0].Name = "LogType1Modified";
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider, true);

            // assert
            var databaseLogTypes = _container.Resolve<MongoCollection<ActivityLogType>>().FindAll().ToList();
            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes[0].Name.ShouldEqual("LogType2");
            databaseLogTypes[1].Name.ShouldEqual("LogType1Modified");
        }
コード例 #6
0
        public void Can_ignore_already_installed_providers()
        {
            // setup
            Can_add_new_log_types_when_installing_a_provider();
            var testLogTypes = GetTestActivityLogTypes();
            testLogTypes[0].Name = "LogType1Modified";
            testLogTypes.Add(new ActivityLogType { Name = "LogType3", SystemKeyword = "LogType3System" });
            var testLogTypeProvider = new Fakes.FakeActivityLogTypeProvider(testLogTypes);

            // act
            _userActivityService.InstallActivityLogTypes(testLogTypeProvider);

            // assert
            var databaseLogTypes = _container.Resolve<MongoCollection<ActivityLogType>>().FindAll().ToList();
            databaseLogTypes.Count.ShouldEqual(2);
            databaseLogTypes[0].Name.ShouldEqual("LogType1");
        }