/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;
using BruSoft.VS2P4;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VsSDK.UnitTestLibrary;
namespace Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.UnitTests
{
///
///This is a test class for Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.SccProviderOptions and is intended
///to contain all Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.SccProviderOptions Unit Tests
///
[TestClass()]
public class SccProviderConnectionOptionsTest
{
///
///A test for OnActivate (CancelEventArgs)
///
[TestMethod()]
public void OnActivateTest()
{
SccProviderConnectionOptions target = new SccProviderConnectionOptions();
MethodInfo method = typeof(SccProviderConnectionOptions).GetMethod("OnActivate", BindingFlags.NonPublic | BindingFlags.Instance);
CancelEventArgs e = new CancelEventArgs();
method.Invoke(target, new object[] { e });
}
/////
/////A test for OnApply (PageApplyEventArgs)
/////
//[TestMethod()]
//public void OnApplyTest()
//{
// SccProviderOptions target = new SccProviderOptions();
// // Create a basic service provider
// using (OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices())
// {
// // Mock the UIShell service to answer Cancel to the dialog invocation
// BaseMock mockUIShell = MockUiShellProvider.GetShowMessageBoxCancel();
// serviceProvider.AddService(typeof(IVsUIShell), mockUIShell, true);
// // Create an ISite wrapper over the service provider
// SiteWrappedServiceProvider wrappedProvider = new SiteWrappedServiceProvider(serviceProvider);
// target.Site = wrappedProvider;
// Assembly shell = typeof(Microsoft.VisualStudio.Shell.DialogPage).Assembly;
// Type argtype = shell.GetType("Microsoft.VisualStudio.Shell.DialogPage+PageApplyEventArgs", true);
// MethodInfo method = typeof(SccProviderOptions).GetMethod("OnApply", BindingFlags.NonPublic | BindingFlags.Instance);
// object eventargs = shell.CreateInstance(argtype.FullName);
// method.Invoke(target, new object[] { eventargs });
// }
//}
///
///A test for OnClosed (EventArgs)
///
[TestMethod()]
public void OnClosedTest()
{
SccProviderConnectionOptions target = new SccProviderConnectionOptions();
MethodInfo method = typeof(SccProviderConnectionOptions).GetMethod("OnClosed", BindingFlags.NonPublic | BindingFlags.Instance);
EventArgs e = new EventArgs();
method.Invoke(target, new object[] { e });
}
///
///A test for OnDeactivate (CancelEventArgs)
///
[TestMethod()]
public void OnDeactivateTest()
{
SccProviderConnectionOptions target = new SccProviderConnectionOptions();
MethodInfo method = typeof(SccProviderConnectionOptions).GetMethod("OnDeactivate", BindingFlags.NonPublic | BindingFlags.Instance);
CancelEventArgs e = new CancelEventArgs();
method.Invoke(target, new object[] { e });
}
///
///A test for Window
///
[TestMethod()]
public void WindowTest()
{
SccProviderConnectionOptions target = new SccProviderConnectionOptions();
PropertyInfo property = typeof(SccProviderConnectionOptions).GetProperty("Window", BindingFlags.NonPublic | BindingFlags.Instance);
IWin32Window val = property.GetValue(target, null) as IWin32Window;
Assert.IsNotNull(val, "The property page control was not created for SccProviderConnectionOptions");
}
}
}