コード例 #1
0
        public void FluentConfigurationBuilderWithLowercasePropertyWatcher_providedTypeWithUppercasePropertiesShouldFail()
        {
            CodeWatcherConfig watcherConfig = CodeWatcherConfig.Create()
                                              .WithWatcher(c => new PropertyNamingFirstLetterWatcher(c).Configure(Naming.LowerCase))
                                              .WatchType(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1))
                                              .Build();

            Assert.IsTrue(watcherConfig.Execute().HasIssues);
        }
コード例 #2
0
        public void FluentConfigurationBuilderWithUppercasePropertyWatcher_providedAssemblyWithUppercasePropertiesShouldPass()
        {
            CodeWatcherConfig watcherConfig = CodeWatcherConfig.Create()
                                              .WithWatcher(c => new PropertyNamingFirstLetterWatcher(c).Configure(Naming.UpperCase))
                                              .WatchAssembly(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1).Assembly)
                                              .Build();

            Assert.IsFalse(watcherConfig.Execute().HasIssues);
        }
コード例 #3
0
        public void FluentConfigurationBuilderWithLowercasePropertyWatcher_skippingAssemblyWithUppercasePropertiesAndWatchingUppercaseTypeFromThatAssemblyShouldFail()
        {
            CodeWatcherConfig watcherConfig = CodeWatcherConfig.Create()
                                              .WithWatcher(c => new PropertyNamingFirstLetterWatcher(c).Configure(Naming.LowerCase))
                                              .SkipAssembly(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1).Assembly)
                                              .WatchType(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1))
                                              .Build();

            Assert.IsTrue(watcherConfig.Execute().HasIssues);
        }
コード例 #4
0
        public void FluentConfigurationBuilderWillFailForFields()
        {
            CodeWatcherConfig config = CodeWatcherConfig.Create()
                                       .WithWatcher(c => new FieldNamingFirstLetterWatcher(c).Configure(Naming.UpperCase))
                                       .WatchAssembly(typeof(DomainModel).Assembly)
                                       .Build();

            //execute configuration
            var result = config.Execute();

            //This will fail
            Assert.True(result.HasIssues);
        }
コード例 #5
0
        public void FluentConfigurationBuilderWithLowercasePropertyWatcher_watchingAssemblyWithUppercasePropertiesAndSkippingUppercaseTypeFromThatAssemblyShouldFailWithoutThatType()
        {
            CodeWatcherConfig watcherConfig = CodeWatcherConfig.Create()
                                              .WithWatcher(c => new PropertyNamingFirstLetterWatcher(c).Configure(Naming.LowerCase))
                                              .WatchAssembly(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1).Assembly)
                                              .SkipType(typeof(Gmtl.CodeWatch.TestData.AllUppercaseProperties.Class1))
                                              .Build();

            var result = watcherConfig.Execute();

            Assert.IsTrue(result.HasIssues);
            Assert.That(result.Issues.All(e => !e.Message.Contains("Class1")));
        }
コード例 #6
0
        public void PropertyNamesShouldStartWithUppercase()
        {
            CodeWatcherConfig config = CodeWatcherConfig.Create()
                                       .WithWatcher(ctx => new PropertyNamingWatcher().Configure(Naming.UpperCase))
                                       .WatchAssembly(typeof(NetDevPLWeb.Program).Assembly)
                                       .WatchAssembly(typeof(NetDevPLBackgoundJobs.Program).Assembly)
                                       .WatchAssembly(typeof(Features.Blogs.Blog).Assembly)
                                       .WatchAssembly(typeof(Features.Facebook.FacebookPost).Assembly)
                                       .WatchAssembly(typeof(Features.NetGroups.Group).Assembly)
                                       .WatchAssembly(typeof(Infrastructure.Helpers.RssProvider).Assembly)
                                       .WatchAssembly(typeof(Infrastructure.MongoDB.MongoDBProvider <object>).Assembly)
                                       .WatchAssembly(typeof(Infrastructure.SharedKernel.Logger).Assembly)
                                       .WatchAssembly(typeof(Features.NetGroups.IntegrationTests.MeetupDataProviderTests).Assembly)

                                       //Types below are skipped till json mapping/attributes are added there
                                       .SkipType(typeof(Features.NetGroups.Group))
                                       .SkipType(typeof(Features.NetGroups.Meta))
                                       .SkipType(typeof(Features.NetGroups.RootObject))
                                       .SkipType(typeof(Features.NetGroups.Venue))
                                       .SkipType(typeof(Features.NetGroups.Result))
                                       .Build();

            config.Execute();
        }