コード例 #1
0
            public void updates_full_name()
            {
                var jsonResponse = GetJson <JObject>("/users/test1");

                HelperExtensions.AssertJson(
                    new { Success = true, Error = "Success", Data = new { FullName = "Updated Full Name" } }, jsonResponse);
            }
コード例 #2
0
            [TestCase("%25", "%", "2", "2")]             // %
            public async Task returns_ok_status_code(string _a, string _ra, string _b, string _rb)
            {
                _response = await GetJson2 <JObject>("/test-encoding/" + _a, "b=" + _b);

                Assert.AreEqual(HttpStatusCode.OK, _lastResponse.StatusCode);
                HelperExtensions.AssertJson(new { a = _ra, b = _rb }, _response);
            }
コード例 #3
0
 // [TestCase("%24", "$", "2", "2")]
 // [TestCase("$", "$", "2", "2")]
 // [TestCase("%3F", "?", "2", "2")] // ?
 // [TestCase("%2F", "/", "2", "2")] // /
 // [TestCase("%20", " ", "2", "2")] // space
 // [TestCase("%25", "%", "2", "2")] // %
 public void returns_ok_status_code(string _a, string _ra, string _b, string _rb)
 {
     _response = GetJson2 <JObject>("/test-encoding-reserved-" + _a, "?b=" + _b);
     Assert.AreEqual(HttpStatusCode.OK, _lastResponse.StatusCode);
     Console.WriteLine(_response.ToString());
     HelperExtensions.AssertJson(new { a = _ra, b = _rb }, _response);
 }
コード例 #4
0
 public void returns_valid_json_data_with_enable_link()
 {
     HelperExtensions.AssertJson(
         new {
         Success = true,
         Error   = "Success",
         Data    =
             new {
             Links = new[] {
                 new {
                     Href = "http://" + _node.ExtHttpEndPoint +
                            "/users/test2/command/reset-password",
                     Rel = "reset-password"
                 },
                 new {
                     Href = "http://" + _node.ExtHttpEndPoint +
                            "/users/test2/command/change-password",
                     Rel = "change-password"
                 },
                 new {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test2",
                     Rel  = "edit"
                 },
                 new {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test2",
                     Rel  = "delete"
                 },
                 new {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test2/command/enable",
                     Rel  = "enable"
                 }
             }
         }
     }, _response);
 }
コード例 #5
0
ファイル: users.cs プロジェクト: arthis/EventStore-1
            public async Task enables_it()
            {
                var jsonResponse = await GetJson <JObject>("/users/test1");

                HelperExtensions.AssertJson(
                    new { Success = true, Error = "Success", Data = new { LoginName = "test1", Disabled = true } },
                    jsonResponse);
            }
コード例 #6
0
            public void disables_it()
            {
                var jsonResponse = GetJson <JObject>("/users/test1");

                HelperExtensions.AssertJson(
                    new { Success = true, Error = "Success", Data = new { LoginName = "test1", Disabled = false } },
                    jsonResponse);
            }
コード例 #7
0
            public void configures_password_changed_notification_system_stream()
            {
                var writePasswordChanged = HandledPasswordChangedNotificationMetaStreamWrites();

                Assert.AreEqual(1, writePasswordChanged.Length);
                var passwordChangedEvent = writePasswordChanged[0].Events.Single();

                HelperExtensions.AssertJson(new { ___maxAge = 3600 }, passwordChangedEvent.Data.ParseJson <JObject>());
            }
コード例 #8
0
        public void truncates_existing_stream_at_correct_position()
        {
            var writes =
                HandledMessages.OfType <ClientMessage.WriteEvents>()
                .OfEventType(SystemEventTypes.StreamMetadata)
                .ToArray();

            Assert.AreEqual(1, writes.Length);
            HelperExtensions.AssertJson(new { ___tb = 2 }, writes[0].Data.ParseJson <JObject>());
        }
コード例 #9
0
        public void combines_checkpoint_tag_with_extra_metadata()
        {
            var writeEvent = _consumer.HandledMessages.OfType <ClientMessage.WriteEvents>().Single();

            Assert.AreEqual(1, writeEvent.Events.Length);
            var @event   = writeEvent.Events[0];
            var metadata = Helper.UTF8NoBom.GetString(@event.Metadata).ParseJson <JObject>();

            HelperExtensions.AssertJson(new { a = 1, b = new { } }, metadata);
            var checkpoint = @event.Metadata.ParseCheckpointTagJson();

            Assert.AreEqual(CheckpointTag.FromPosition(0, 200, 150), checkpoint);
        }
        public void publishes_write_events()
        {
            var writeEvents =
                _consumer.HandledMessages.OfType <ClientMessage.WriteEvents>()
                .ExceptOfEventType(SystemEventTypes.StreamMetadata)
                .ToArray();

            Assert.AreEqual(1, writeEvents.Length);
            var writeEvent = writeEvents.Single();

            Assert.NotNull(writeEvent.Metadata);
            var metadata = Helper.UTF8NoBom.GetString(writeEvent.Metadata);

            HelperExtensions.AssertJson(
                new { ___causedBy = _causedBy, ___correlationId = _correlationId }, metadata.ParseJson <JObject>());
        }
コード例 #11
0
 public void returns_valid_json_data()
 {
     HelperExtensions.AssertJson(
         new
     {
         Success = true,
         Error   = "Success",
         Data    =
             new
         {
             LoginName   = "test1",
             FullName    = "User Full Name",
             Groups      = new[] { "admin", "other" },
             Disabled    = false,
             Password___ = false,
             Links       = new[]
             {
                 new
                 {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test1/command/reset-password",
                     Rel  = "reset-password"
                 },
                 new
                 {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test1/command/change-password",
                     Rel  = "change-password"
                 },
                 new
                 {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test1",
                     Rel  = "edit"
                 },
                 new
                 {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test1",
                     Rel  = "delete"
                 },
                 new
                 {
                     Href = "http://" + _node.ExtHttpEndPoint + "/users/test1/command/disable",
                     Rel  = "disable"
                 }
             }
         }
     }, _response);
 }
コード例 #12
0
 public void returns_valid_json_data()
 {
     HelperExtensions.AssertJson(
         new
     {
         Success = true,
         Error   = "Success",
         Data    =
             new
         {
             LoginName   = "test1",
             FullName    = "User Full Name",
             Groups      = new[] { "admin", "other" },
             Disabled    = false,
             Password___ = false
         }
     }, _response);
 }
コード例 #13
0
ファイル: feed_reader.cs プロジェクト: tubo70/EventStore
 public void returns_correct_event()
 {
     HelperExtensions.AssertJson(
         new
     {
         Events =
             new[]
         {
             new
             {
                 EventStreamId = TestStreamName,
                 EventNumber   = 0,
                 EventType     = "event-type",
                 Data          = new { SampleData = 1 },
                 Metadata      = new { M = false },
             }
         }
     }, _response);
 }
コード例 #14
0
ファイル: feed.cs プロジェクト: mjaric/EventStore
 public void returns_a_feed_with_a_single_entry_referring_to_the_last_event()
 {
     HelperExtensions.AssertJson(new { entries = new[] { new { Id = _lastEventLocation } } }, _feed);
 }
コード例 #15
0
 public void correct_event_sequence_has_been_processed()
 {
     HelperExtensions.AssertJson(new { d = new[] { 1, 2, 3, 6, 7, 8 } }, _stateData);
 }
コード例 #16
0
ファイル: basic.cs プロジェクト: pvanbuijtene/EventStore
            public async Task returns_a_location_header_that_can_be_read_as_json()
            {
                var json = await GetJson <JObject>(_response.Headers.GetLocationAsString());

                HelperExtensions.AssertJson(new { A = "1" }, json);
            }
コード例 #17
0
ファイル: basic.cs プロジェクト: some1one/EventStore
 public void returns_correct_body()
 {
     HelperExtensions.AssertJson(new { A = "1" }, _json);
 }
コード例 #18
0
ファイル: basic.cs プロジェクト: some1one/EventStore
            public void returns_a_location_header_for_the_first_posted_event()
            {
                var json = GetJson <JObject>(_response.Headers[HttpResponseHeader.Location]);

                HelperExtensions.AssertJson(new { A = "1" }, json);
            }
コード例 #19
0
ファイル: basic.cs プロジェクト: some1one/EventStore
            public void the_json_data_is_not_mangled()
            {
                var json = GetJson <JObject>(_response.Headers[HttpResponseHeader.Location]);

                HelperExtensions.AssertJson(new { A = "1987-11-07T00:00:00.000+01:00" }, json);
            }
コード例 #20
0
ファイル: basic.cs プロジェクト: some1one/EventStore
            public void returns_a_location_header_that_can_be_read_as_json()
            {
                var json = GetJson <JObject>(_response.Headers[HttpResponseHeader.Location]);

                HelperExtensions.AssertJson(new { A = "1" }, json);
            }
コード例 #21
0
ファイル: basic.cs プロジェクト: pvanbuijtene/EventStore
            public async Task the_metadata_retains_the_type()
            {
                var json = await GetJson <JObject>(_response.Headers.GetLocationAsString(), extra : "embed=tryharder", accept : ContentType.AtomJson);

                HelperExtensions.AssertJson(_data.First()["metadata"], JObject.Parse(json["content"]["metadata"].ToString()));
            }
コード例 #22
0
ファイル: feed_reader.cs プロジェクト: tubo70/EventStore
 public void returns_correct_reader_position()
 {
     HelperExtensions.AssertJson(
         new { ReaderPosition = CheckpointTag.FromStreamPosition(TestStreamName, 0).ToJsonRaw() }, _response);
 }
コード例 #23
0
ファイル: basic.cs プロジェクト: pvanbuijtene/EventStore
            public async Task the_json_data_is_not_mangled()
            {
                var json = await GetJson <JObject>(_response.Headers.GetLocationAsString());

                HelperExtensions.AssertJson(new { A = "1987-11-07T00:00:00.000+01:00" }, json);
            }
コード例 #24
0
ファイル: basic.cs プロジェクト: pvanbuijtene/EventStore
            public async Task returns_a_location_header_for_the_first_posted_event()
            {
                var json = await GetJson <JObject>(_response.Headers.GetLocationAsString());

                HelperExtensions.AssertJson(new { A = "1" }, json);
            }