private void doAnalytics(ShareEventStatus?evStatus, SecureItem item) { if (evStatus.HasValue) { var analytics2 = inAppAnalyitics.Get <Events.Sharing, SharingItem>(); if (item.SecureItemTypeName == DefaultProperties.SecurityItemType_PasswordVault) { analytics2.Log(new SharingItem(ShareItemType.Password, evStatus.Value)); } if (item.SecureItemTypeName == DefaultProperties.SecurityItemType_DigitalWallet) { var shareType = SharingItem.GetShareEventItemTypeBaySecureItemType(item.Type); if (shareType.HasValue) { analytics2.Log(new SharingItem(shareType.Value, evStatus.Value)); } } if (item.SecureItemTypeName == DefaultProperties.SecurityItemType_PersonalInfo) { var shareType = SharingItem.GetShareEventItemTypeBaySecureItemType(item.Type); if (shareType.HasValue) { analytics2.Log(new SharingItem(shareType.Value, evStatus.Value)); } } } }
/// <summary> /// only to me /// </summary> public void ClickOnlyMe() { SharingItem.SelectOnlyToMe(); DriverCommands.WaitAndMeasurePageLoadTime(90, 30); InitElements(); }
//implemented methods public override void InputFormFields() { SharingItem.InputFormFields(); DriverCommands.WaitAndMeasurePageLoadTime(90, 30); InitElements(); }
/// <summary> /// share with everyone /// </summary> public void ClickShareWithEveryone() { SharingItem.SelectEveryone(); DriverCommands.WaitAndMeasurePageLoadTime(90, 30); InitElements(); }
public void Init() { // テスト対象のクラス内で使われる変数のモック testRec = Substitute.For <Recipient>(); //testAdd = Substitute.For<AddressEntry>(); testExchUser = Substitute.For <ExchangeUser>(); // テスト用のXXXItemを、モックで作成 testMail = Substitute.For <MailItem>(); testMeeting = Substitute.For <MeetingItem>(); testAppointment = Substitute.For <AppointmentItem>(); testSharing = Substitute.For <SharingItem>(); testReport = Substitute.For <TestReportItem>(); testDocument = Substitute.For <DocumentItem>(); // ------------------------------------------------------------------------------------------------ // VSで実行する場合 // ------------------------------------------------------------------------------------------------ //// Factoryクラスは、自作のTestFactoryクラス&その中で使うTestAddInクラスがないとうまくいかない //// ThisAddInクラスのタイプを取得 //TestFactory testFactory = new TestFactory(); //IServiceProvider testService = Substitute.For<IServiceProvider>(); //ThisAddIn testAddIn = new ThisAddIn(testFactory, testService); //// リフレクション //// アセンブリを読み込み、モジュールを取得 //Assembly asm = Assembly.LoadFrom(@".\ORCAUnitTest\bin\Debug\OutlookRecipientConfirmationAddin.dll"); // ------------------------------------------------------------------------------------------------ // batで、このプロジェクトのテストをまとめて実行する場合 // ------------------------------------------------------------------------------------------------ // 共通で使うThisAddInクラスを取得 ThisAddIn testAddIn = GetContactItemUnitTest.testAddIn; // リフレクション // アセンブリを読み込み、モジュールを取得 Assembly asm = Assembly.LoadFrom(@".\OutlookRecipientConfirmationAddin.dll"); // ------------------------------------------------------------------------------------------------ Module mod = asm.GetModule("OutlookRecipientConfirmationAddin.dll"); Type typeThisAddIn = testAddIn.GetType(); // Applicaitionのモック作成 FieldInfo fieldApp = typeThisAddIn.GetField("Application", BindingFlags.NonPublic | BindingFlags.Instance); testApp = Substitute.For <TestApplication>(); fieldApp.SetValue(testAddIn, testApp); // Sessionのモック作成 testNs = Substitute.For <NameSpace>(); testNs.CreateRecipient(Arg.Any <string>()).Returns(testRec); testApp.Session.Returns(testNs); // ------------------------------------------------------------------------------------------------ // このクラスを単独で実行する場合 // ------------------------------------------------------------------------------------------------ //// Globalsのタイプと、ThisAddInプロパティを取得 //Type typeGlobal = mod.GetType("OutlookRecipientConfirmationAddin.Globals"); //PropertyInfo testProp = typeGlobal.GetProperty("ThisAddIn", BindingFlags.NonPublic | BindingFlags.Static); //// ThisAddinプロパティに、モックなどを使って作った値をセットする //testProp.SetValue(null, testAddIn); // ------------------------------------------------------------------------------------------------ // テスト対象のクラス(Utility)のタイプを取得 Type type = mod.GetType("OutlookRecipientConfirmationAddin.Utility"); // インスタンスを生成し、メソッドにアクセスできるようにする obj = Activator.CreateInstance(type); mi = type.GetMethod("GetSenderInfomation"); }
/// <summary> /// テスト対象メソッドで使われる値のReturnsを設定するメソッド /// </summary> /// <param name="testRecNames">Recipientのアドレス</param> /// <param name="testRecSendable">RecipientのSendableプロパティ</param> /// <param name="testRecType">RecipientのType</param> /// <param name="item">選択されたitem</param> private void SubstituteRecProps(string[] testRecNames, bool[] testRecSendable, int[] testRecType, object item) { int i = 0; if (item is MailItem) { MailItem testItem = (MailItem)item; foreach (string testRec in testRecNames) { // テスト用Recipientのプロパティに値を設定 testItem.Recipients[i + 1].Address.Returns(testRecNames[i]); testItem.Recipients[i + 1].Sendable.Returns(testRecSendable[i]); testItem.Recipients[i + 1].Type.Returns(testRecType[i]); i++; } } else if (item is MeetingItem) { MeetingItem testItem = (MeetingItem)item; foreach (string testRec in testRecNames) { // テスト用Recipientのプロパティに値を設定 testItem.Recipients[i + 1].Address.Returns(testRecNames[i]); testItem.Recipients[i + 1].Sendable.Returns(testRecSendable[i]); testItem.Recipients[i + 1].Type.Returns(testRecType[i]); i++; } } else if (item is AppointmentItem) { AppointmentItem testItem = (AppointmentItem)item; foreach (string testRec in testRecNames) { // テスト用Recipientのプロパティに値を設定 testItem.Recipients[i + 1].Address.Returns(testRecNames[i]); testItem.Recipients[i + 1].Sendable.Returns(testRecSendable[i]); testItem.Recipients[i + 1].Type.Returns(testRecType[i]); i++; } } else if (item is SharingItem) { SharingItem testItem = (SharingItem)item; foreach (string testRec in testRecNames) { // テスト用Recipientのプロパティに値を設定 testItem.Recipients[i + 1].Address.Returns(testRecNames[i]); testItem.Recipients[i + 1].Sendable.Returns(testRecSendable[i]); testItem.Recipients[i + 1].Type.Returns(testRecType[i]); i++; } } }