示例#1
0
        public void given_service_is_down_when_getting_should_throw()
        {
            var baseUri = new Uri("http://localhost:5000");
            var gateway = new SystemGateway(baseUri);

            Action action = () => gateway.Get();

            action
            .ShouldThrow <ApplicationException>()
            .WithMessage(SystemGateway.GeneralError)
            .WithInnerException <AggregateException>();
        }
示例#2
0
        public void given_resource_is_not_found_when_getting_should_throw()
        {
            using (var host = new ServiceStubsHost(new Uri("http://localhost:5000/")))
            {
                host.Start();
                var gateway = new SystemGateway(new Uri("http://localhost:5000/notfound/"));

                Action action = () => gateway.Get();

                action
                .ShouldThrow <ApplicationException>()
                .WithMessage(SystemGateway.NotFoundErrort);
            }
        }
示例#3
0
        public void given_service_is_up_when_getting_should_return_system_info()
        {
            var baseUri = new Uri("http://localhost:5000/");

            using (var host = new ServiceStubsHost(baseUri))
            {
                host.Start();
                var gateway = new SystemGateway(baseUri);

                var info = gateway.Get();

                var expectedMachineName = Environment.MachineName;
                var expectedDateTime    = new DateTimeOffset(2012, 01, 01, 11, 24, 15, TimeSpan.FromHours(-5));

                info.ServerName.Should().Be(expectedMachineName);
                info.ServerTimeStamp.Should().Be(expectedDateTime);
            }
        }