예제 #1
0
 public void SetUp()
 {
     TestRegistry.SetUpTestRegistry();
     _fileProcessingService       = new Mock <IEdiFileProcessingService>();
     _createOrderMessagePublisher = new Mock <IEdiMessagePublisher>();
     _sut = new EdiDocsInWorker(_createOrderMessagePublisher.Object, _fileProcessingService.Object);
 }
        public void Test1()
        {
            var registry  = new TestRegistry();
            var container = new Container(registry);


            container.GetAllInstances <IApplicationEventHandler <Created> >().Count().ShouldBe(2);
        }
예제 #3
0
        public void two_instances_of_a_public_derived_registry_type_are_considered_equal()
        {
            var registry1 = new TestRegistry();
            var registry2 = new TestRegistry();
            var registry3 = new TestRegistry2();
            var registry4 = new TestRegistry2();

            registry1.Equals((object)registry1).ShouldBeTrue();
            registry1.Equals((object)registry2).ShouldBeTrue();
            registry2.Equals((object)registry1).ShouldBeTrue();
            registry3.Equals((object)registry4).ShouldBeTrue();

            registry1.Equals((object)registry3).ShouldBeFalse();
            registry3.Equals((object)registry1).ShouldBeFalse();
        }
예제 #4
0
        public void when_installing_regpackage_on_already_installed()
        {
            using (var tester = new TestRegistry(false))
            {
                LocalInstallOn(ChocoTestContext.installupdate2, (conf) =>
                {
                    conf.PackageNames = conf.Input = installpackage2_id;

                    tester.Lock();
                    tester.DeleteInstallEntries(installpackage2_id);
                    tester.AddInstallPackage2Entry();
                }, ChocoTestContext.pack_installpackage2_1_0_0);

                tester.DeleteInstallEntries(installpackage2_id);
            }
        }
예제 #5
0
        public void when_installing_regpackage_on_empty()
        {
            using (var tester = new TestRegistry())
            {
                tester.DeleteInstallEntries(installpackage2_id);
                tester.LogInstallEntries(false, installpackage2_id);

                InstallOnEmpty((conf) =>
                {
                    conf.PackageNames = conf.Input = installpackage2_id;
                }, ChocoTestContext.pack_installpackage2_1_0_0);

                tester.LogInstallEntries(true, installpackage2_id);
                tester.DeleteInstallEntries(installpackage2_id);
            }
        }
예제 #6
0
        public void when_listing_regpackage()
        {
            using (var tester = new TestRegistry(false))
            {
                ExactPackagesList((conf) =>
                {
                    conf.ListCommand.LocalOnly            = true;
                    conf.ListCommand.ShowRegistryPackages = true;

                    tester.Lock();
                    tester.AddInstallPackage2Entry();
                }, ChocoTestContext.installupdate2);

                tester.DeleteInstallEntries(installpackage2_id);
            }
        }
예제 #7
0
        public void when_uninstalling_registry_package()
        {
            using (var tester = new TestRegistry(false))
            {
                TestUninstall((conf) =>
                {
                    conf.PackageNames = conf.Input = installpackage2_id;

                    tester.Lock();
                    tester.AddInstallPackage2Entry();
                    tester.LogInstallEntries(false, installpackage2_id);
                }, ChocoTestContext.installupdate2);

                tester.LogInstallEntries(true, installpackage2_id);
                tester.DeleteInstallEntries(installpackage2_id);
            }
        }
예제 #8
0
        public void two_instances_of_a_public_derived_registry_type_are_considered_equal()
        {
            var registry1 = new TestRegistry();
            var registry2 = new TestRegistry();
            var registry3 = new TestRegistry2();
            var registry4 = new TestRegistry2();

            registry1.Equals((object) registry1).ShouldBeTrue();
            registry1.Equals((object) registry2).ShouldBeTrue();
            registry2.Equals((object) registry1).ShouldBeTrue();
            registry3.Equals((object) registry4).ShouldBeTrue();

            registry1.Equals((object) registry3).ShouldBeFalse();
            registry3.Equals((object) registry1).ShouldBeFalse();
        }
 public void CreateDefault_GetItemExact ()
 {
   _registry = TestRegistry.CreateDefault ();
   Assert.That (_registry.GetItemExact (typeof (TestRegistryImplementation)), Is.TypeOf (typeof (TestRegistryImplementation)));
 }
 public void SetUp ()
 {
   _registry = new TestRegistry();
 }
예제 #11
0
 public static void Setup(TestContext testContext)
 {
     Database.SetInitializer <Context>(null);
     TestRegistry.Configure();
 }
예제 #12
0
        public OwinMetricsTestData()
        {
            const int timePerRequest = 100;
            const string json = "{ 'id': '1'} ";

            Clock = new TestClock();
            var scheduler = new TestScheduler(Clock);
            TimerMetric = new TimerMetric(SamplingType.SlidingWindow, new MeterMetric(Clock, scheduler), Clock);
            CounterMetric = new TestCounter();
            HistogramMetric = new HistogramMetric();
            MeterMetric = new MeterMetric(Clock, scheduler);

            var server = TestServer.Create(app =>
            {
                var registery = new TestRegistry
                {
                    TimerInstance = TimerMetric,
                    CounterInstance = CounterMetric,
                    HistogramInstance = HistogramMetric,
                    MeterInstance = MeterMetric
                };

                OwinMetricsConfig owin = new OwinMetricsConfig(middleware => app.Use(middleware), registery, Metric.Config.HealthStatus);
                owin.WithRequestMetricsConfig(c => c.RegisterAllMetrics());

                app.Run(context =>
                {
                    Clock.Advance(TimeUnit.Milliseconds, timePerRequest);
                    if (context.Request.Path.ToString() == "/test/action")
                    {
                        return context.Response.WriteAsync("response");
                    }

                    if (context.Request.Path.ToString() == "/test/error")
                    {
                        context.Response.StatusCode = 500;
                        return context.Response.WriteAsync("response");
                    }

                    if (context.Request.Path.ToString() == "/test/size")
                    {
                        return context.Response.WriteAsync("response");
                    }

                    if (context.Request.Path.ToString() == "/test/post")
                    {
                        return context.Response.WriteAsync("response");
                    }

                    context.Response.StatusCode = 404;
                    return context.Response.WriteAsync("not found");
                });

            });

            ExpectedResults = new OwinExpectedMetrics(timePerRequest, 6, 1);

            server.HttpClient.GetAsync("http://local.test/test/error").Result.StatusCode.Should().Be(HttpStatusCode.InternalServerError);
            server.HttpClient.GetAsync("http://local.test/test/action").Result.StatusCode.Should().Be(HttpStatusCode.OK);
            server.HttpClient.GetAsync("http://local.test/test/action").Result.StatusCode.Should().Be(HttpStatusCode.OK);
            server.HttpClient.GetAsync("http://local.test/test/action").Result.StatusCode.Should().Be(HttpStatusCode.OK);
            server.HttpClient.GetAsync("http://local.test/test/action").Result.StatusCode.Should().Be(HttpStatusCode.OK);
            var postContent = new StringContent(json);
            postContent.Headers.Add("Content-Length", json.Length.ToString());
            server.HttpClient.PostAsync("http://local.test/test/post", postContent);
        }
예제 #13
0
        public void CatchesExpectedExceptions(Exception exception)
        {
            Action action = () => { throw exception; };

            TestRegistry.TestRegistryExceptionWrapper(action).Should().Be(exception);
        }