Пример #1
0
        public void Should_add_location_header_to_the_message_when_response_contains_a_api_resource()
        {
            var apiResource = new TestResource();

            var response = new ConflictResponse(apiResource);

            AssertExpectedStatus(response);
            response.Headers.Location.ShouldEqual(apiResource.Location);
        }
Пример #2
0
        private void ImportWaypoints(Map newMap)
        {
            bool             Continue = false;
            ConflictResponse response = ConflictResponse.Merged;

            foreach (Waypoint wp in newMap.GetWaypoints())
            {
                if (map.HasWaypoint(wp.Location))
                {
                    // There is a conflict in waypoints

                    if (Continue && response == ConflictResponse.Original)
                    {
                        // User has chosen to use the original waypoint, don't change anything
                        break;
                    }

                    Waypoint oldWp = map.GetWaypoint(wp.Location);
                    if (wp.IsExactMatch(oldWp))
                    {
                        // The original waypoint is an exact match, no need to change
                        break;
                    }

                    // Resolve the conflict
                    WaypointConflict conflict = new WaypointConflict(oldWp, wp);
                    conflict.Text = "Waypoint Conflict - " + wp.Location.ToString();
                    if (!Continue)
                    {
                        // User has not opted to bypass resolution screen
                        conflict.ShowDialog(this);
                        response = conflict.Response;
                        Continue = conflict.ContinueWithRemaining;
                    }

                    // Correct the resolved conflict
                    if (response == ConflictResponse.New)
                    {
                        oldWp.Copy(wp);
                    }
                    else if (response == ConflictResponse.Merged)
                    {
                        oldWp.Copy(conflict.Merged);
                    }
                }
                else
                {
                    // There was no conflict
                    map.AddWaypoint(wp);
                }
            }
        }
Пример #3
0
 private void btnUseNew_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.New;
     this.Close();
 }
Пример #4
0
 private void btnUseOriginal_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.Original;
     this.Close();
 }
Пример #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.Merged;
     this.ContinueWithRemaining = chkContinue.Checked;
     this.Close();
 }
Пример #6
0
        public void Should_return_an_http_response_message_with_expected_status()
        {
            var response = new ConflictResponse();

            AssertExpectedStatus(response);
        }
Пример #7
0
 private void btnUseOriginal_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.Original;
     this.Close();
 }
Пример #8
0
 private void btnUseNew_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.New;
     this.Close();
 }
Пример #9
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     this.Response = ConflictResponse.Merged;
     this.ContinueWithRemaining = chkContinue.Checked;
     this.Close();
 }