Beispiel #1
0
        public void GetSenderInfoSharingTest1()
        {
            string testName         = "Kosaka Kenta (小坂 健太)";
            string testCompanyName  = "リコーITソリューションズ";
            string testDepartment   = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ";
            string testJobTitle     = "担当";
            string testEmailAddress = "*****@*****.**";
            string expectedJobTitle = "";

            testAdd = Substitute.For <AddressEntry>();

            // モックのReturn値を設定
            testSharing.SenderEmailAddress.Returns(testEmailAddress);
            testRec.AddressEntry.Returns(testAdd);

            testAdd.GetExchangeUser().Returns(testExchUser);
            testExchUser.Name.Returns(testName);
            testExchUser.Department.Returns(testDepartment);
            testExchUser.CompanyName.Returns(testCompanyName);
            testExchUser.JobTitle.Returns(testJobTitle);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testSharing });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, expectedJobTitle, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #2
0
        public void GetSenderInfoSharingTest2()
        {
            string testName               = "Kosaka Kenta (小坂 健太)";
            string testEmailAddress       = "*****@*****.**";
            string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testEmailAddress);

            testAdd = Substitute.For <AddressEntry>();

            // モックでつかうデータを用意
            testSharing.SenderName.Returns(testName);
            testSharing.SenderEmailAddress.Returns(testEmailAddress);

            // モックのReturn値を設定
            testRec.AddressEntry.Returns(testAdd);

            // GetExchangeUserメソッドで、例外が発生
            testAdd.GetExchangeUser().Returns(x => { throw new System.Exception(); });

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testSharing });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #3
0
        public void GetSenderInfoAppointTest3()
        {
            string testName               = "Kinoshita Yasuyuki (木下 康行)";
            string testEmailAddress       = "*****@*****.**";
            string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testEmailAddress);

            testAdd         = Substitute.For <AddressEntry>();
            testAppointment = Substitute.For <AppointmentItem>();

            // Recipients[1]のExchangeUserで例外が発生
            testAppointment.Recipients[1].AddressEntry.Returns(x => { throw new System.Exception(); });

            // モックのReturn値を設定
            testNs.CurrentUser.AddressEntry.Returns(testAdd);
            testAdd.Name    = testName;
            testAdd.Address = testEmailAddress;
            testAdd.GetExchangeUser().Returns((ExchangeUser)null);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testAppointment });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #4
0
        public void GetSenderInfoAppointTest2()
        {
            string testName         = "Kosaka Kenta (小坂 健太)";
            string testCompanyName  = "リコーITソリューションズ";
            string testDepartment   = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ";
            string testJobTitle     = "担当";
            string expectedJobTitle = "";

            testAdd         = Substitute.For <AddressEntry>();
            testAppointment = Substitute.For <AppointmentItem>();

            // Recipients[1]のExchangeUserで例外が発生
            testAppointment.Recipients[1].AddressEntry.Returns(x => { throw new System.Exception(); });

            // モックのReturn値を設定
            testNs.CurrentUser.AddressEntry.Returns(testAdd);

            testExchUser.Name.Returns(testName);
            testExchUser.Department.Returns(testDepartment);
            testExchUser.CompanyName.Returns(testCompanyName);
            testExchUser.JobTitle.Returns(testJobTitle);
            testAdd.GetExchangeUser().Returns(testExchUser);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testAppointment });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, expectedJobTitle, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #5
0
        public void GetSenderInfoMeetingTest5()
        {
            string testAddress            = "*****@*****.**";
            string testName               = "Yasuyuki Kinoshita / R / RSI";
            string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testAddress);

            testAdd = Substitute.For <AddressEntry>();

            // モックでつかうデータを用意
            testMeeting.SenderName.Returns(testName);
            testMeeting.SenderEmailAddress.Returns(testAddress);

            // モックのReturn値を設定
            testRec.AddressEntry.Returns(testAdd);
            testRec.Name.Returns(testName);
            testRec.Address.Returns(testAddress);

            // GetExchangeUserメソッドで、例外が発生
            testAdd.GetExchangeUser().Returns((ExchangeUser)null);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testMeeting });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #6
0
        public void GetSenderInfoMailTest3()
        {
            string testName        = "Kobayashi Gen (小林 元)";
            string testCompanyName = "リコーITソリューションズ";
            string testDepartment  = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ";
            string testJobTitle    = "部長";

            testAdd = Substitute.For <AddressEntry>();

            // モックでつかうデータを用意
            testMail.Sender = null;
            testMail.SenderEmailAddress.Returns("*****@*****.**");

            testAdd = Substitute.For <AddressEntry>();

            // モックのReturn値を設定
            testRec.AddressEntry.Returns(testAdd);

            testExchUser.Name.Returns(testName);
            testExchUser.Department.Returns(testDepartment);
            testExchUser.CompanyName.Returns(testCompanyName);
            testExchUser.JobTitle.Returns(testJobTitle);
            testAdd.GetExchangeUser().Returns(testExchUser);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testMail });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, testJobTitle, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #7
0
        public void GetSenderInfoDocumentTest1()
        {
            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testDocument });

            // メソッドの戻り値がnullであることを確認
            Assert.IsNull(actual);
        }
Beispiel #8
0
 /// <summary>
 /// テスト対象メソッドの戻り値と、期待結果を比較するメソッド
 /// </summary>
 /// <param name="actual">メソッドからもどってきたRecipientInformationDto</param>
 /// <param name="expected">期待する結果を入れたRecipientInformationDto</param>
 private void CompareRecInfoDto(RecipientInformationDto actual, RecipientInformationDto expected)
 {
     Assert.That(actual.fullName, Is.EqualTo(expected.fullName));
     Assert.That(actual.division, Is.EqualTo(expected.division));
     Assert.That(actual.companyName, Is.EqualTo(expected.companyName));
     Assert.That(actual.recipientType, Is.EqualTo(expected.recipientType));
     Assert.That(actual.jobTitle, Is.EqualTo(expected.jobTitle));
     Assert.That(actual.emailAddress, Is.EqualTo(expected.emailAddress));
 }
Beispiel #9
0
        public void GetSenderInfoReportTest1()
        {
            string testSender = "Microsoft Outlook";

            testAdd = Substitute.For <AddressEntry>();

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testReport });

            // 期待結果
            RecipientInformationDto expected = new RecipientInformationDto(testSender, OlMailRecipientType.olOriginator);

            // actualとexpectedを比較
            CompareRecInfoDto(actual, expected);
        }
Beispiel #10
0
        public void GetSenderInfoAppointTest4()
        {
            testAdd         = Substitute.For <AddressEntry>();
            testAppointment = Substitute.For <AppointmentItem>();

            // Recipients[1]のExchangeUserで例外が発生
            testAppointment.Recipients[1].AddressEntry.Returns(x => { throw new System.Exception(); });

            // モックのReturn値を設定
            testNs.CurrentUser.AddressEntry.Returns((AddressEntry)null);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testAppointment });

            // メソッドの戻り値がnullであることを確認
            Assert.IsNull(actual);
        }
Beispiel #11
0
        public void GetSenderInfoMailTest5()
        {
            testAdd = Substitute.For <AddressEntry>();

            // モックでつかうデータを用意
            testMail.Sender = null;
            testMail.SenderEmailAddress.Returns((string)null);
            testMail.SenderName.Returns((string)null);

            // モックのReturn値を設定
            testRec.AddressEntry.Returns(testAdd);

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testMail });

            // メソッドの戻り値がnullであることを確認
            Assert.IsNull(actual);
        }
Beispiel #12
0
        public void GetSenderInfoSharingTest3()
        {
            string testEmailAddress = "*****@*****.**";

            testAdd = Substitute.For <AddressEntry>();

            // モックでつかうデータを用意
            testSharing.SenderName.Returns((string)null);
            testSharing.SenderEmailAddress.Returns(testEmailAddress);

            // モックのReturn値を設定
            testRec.AddressEntry.Returns(testAdd);

            // GetExchangeUserメソッドで、例外が発生
            testAdd.GetExchangeUser().Returns(x => { throw new System.Exception(); });

            // テストするメソッドにアクセスし、実際の結果を取得
            RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testSharing });

            // メソッドの戻り値がnullであることを確認
            Assert.IsNull(actual);
        }