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();
        }
Exemple #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();
        }
Exemple #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");
        }
Exemple #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");
        }
        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");
        }
        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");
        }