Пример #1
0
        //イベントが本日の場合、タイトルあり、アーティストなし
        public void DoServiceTest14()
        {
            //Arrange
            List <Account> accounts = new List <Account>
            {
                new Account
                {
                    is_valid     = 1,
                    id           = "testId",
                    password     = "******",
                    access_token = "oA4C4FdNKL9ZB9Uo90XwUJ05vr15Cw2yNA2bhUrbh4h"
                }
            };

            EventInfo eventInfo = new EventInfo
            {
                date   = "2020.03.30",
                title  = "testTitle",
                artist = ""
            };

            int    expectedListSize = accounts.Count;
            string expectedToken    = accounts[0].access_token;
            string expectedMsg      = Messages.AM01("testTitle", "") + Messages.URL;


            IDbAccessor         db = new StubDbAccessor(accounts);
            IEventInfoConverter ei = new StubEventInfoConverter(eventInfo);
            MockLineMessenger   lm = new MockLineMessenger();

            //Act
            using (NotificationService service = new NotificationService(db, ei, lm))
            {
                service.DoService(inputData);
            }

            //Assert
            int    actualListSize = lm.InputList.Count;
            string actualToken    = lm.InputList[0].accessToken;
            string actualMsg      = lm.InputList[0].message;

            Assert.IsTrue(expectedListSize == actualListSize);
            Assert.AreEqual(expectedToken, actualToken);
            Assert.AreEqual(expectedMsg, actualMsg);
        }