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); }
[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); }
// [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); }
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); }
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); }
public void disables_it() { var jsonResponse = GetJson <JObject>("/users/test1"); HelperExtensions.AssertJson( new { Success = true, Error = "Success", Data = new { LoginName = "test1", Disabled = false } }, jsonResponse); }
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>()); }
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>()); }
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>()); }
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); }
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); }
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); }
public void returns_a_feed_with_a_single_entry_referring_to_the_last_event() { HelperExtensions.AssertJson(new { entries = new[] { new { Id = _lastEventLocation } } }, _feed); }
public void correct_event_sequence_has_been_processed() { HelperExtensions.AssertJson(new { d = new[] { 1, 2, 3, 6, 7, 8 } }, _stateData); }
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); }
public void returns_correct_body() { HelperExtensions.AssertJson(new { A = "1" }, _json); }
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); }
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); }
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); }
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())); }
public void returns_correct_reader_position() { HelperExtensions.AssertJson( new { ReaderPosition = CheckpointTag.FromStreamPosition(TestStreamName, 0).ToJsonRaw() }, _response); }
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); }
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); }