Exemple #1
0
        private void TFSConnectB_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var proxy = new ConfigurationProxy();
                var config = proxy.Retrieve();

                config.TfsUrl = TFSURLTB.Text;
                config.TfsUserName = TFSUsernameTB.Text;
                config.TfsPassword = TFSPasswordTB.Text;

                proxy.Store(config);

                TFSStatusLabel.Text = "Not connected";

                TfsServer = null;
                // Connect to TFS
                TfsServer = Utils.ConnectToTFS();

                TFSStatusLabel.Text = "Connected to " + TFSURLTB.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                UpdateFormControlStatus();
            }
        }
Exemple #2
0
        private void TFSUpdateB_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var proxy = new ConfigurationProxy();
                var config = proxy.Retrieve();

                config.TfsUrl = ListenerURLTB.Text;
                proxy.Store(config);

                // Get Eventing Service
                var eventService = (IEventService)TfsServer.GetService(typeof(IEventService));

                // Set delivery preferences
                var dPref = new DeliveryPreference { Schedule = DeliverySchedule.Immediate, Address = config.TfsUrl, Type = DeliveryType.Soap };

                const string tag = "VersionOneTFSServer";

                // Unsubscribe to all events
                foreach (var s in eventService.GetEventSubscriptions(TfsServer.AuthorizedIdentity.Descriptor, tag))
                {
                    eventService.UnsubscribeEvent(s.ID);
                }

                // Subscribe to checked events
                var filter = string.Empty;
                eventService.SubscribeEvent("CheckinEvent", filter, dPref, tag);
                eventService.SubscribeEvent("BuildCompletionEvent2", filter, dPref, tag);

                UpdateFormControlStatus();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
 /// <summary>
 /// Exercise mock server
 /// </summary>
 public void given_data_is_being_sent_and_received_to_the_server()
 {
     var mock = new PretendsToBeConnectedToHttpClient();
     var proxy = new ConfigurationProxy(mock);
     it["then its possible to submit valid configuration"] = () =>
         {
             var result = proxy.Store(_serializationTarget);
             result[StatusKey.Status].should_be(StatusCode.Ok);
         };
     it["then the original object is retrieved on get"] = () => proxy.Retrieve().should_be(_serializationTarget);
 }