예제 #1
0
        private static void AssertEmotionalJenkinsProperties(Butler butler)
        {
            AssertDefaultProperties(butler);

            Assert.AreEqual(6, butler.Appearances.Count);
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Normal];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("jenkins.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(2, appearance.ExitAnimation.Count);
                Assert.AreEqual(false, appearance.Topmost);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Sad];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("sad.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(2, appearance.ExitAnimation.Count);
                Assert.AreEqual(false, appearance.Topmost);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Angry];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("oni.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(2, appearance.ExitAnimation.Count);
                Assert.AreEqual(false, appearance.Topmost);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Rageful];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("onibi.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(2, appearance.ExitAnimation.Count);
                Assert.AreEqual(true, appearance.Topmost);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Expectant];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("ninja.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(4, appearance.ExitAnimation.Count);
                Assert.AreEqual(false, appearance.Topmost);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Happy];
                AssertDefaultPropertiesOfEmotionalJenkins(appearance);

                Assert.AreEqual("jenkins.png", appearance.ImageFile);
                Assert.AreEqual(3, appearance.EnterAnimation.Count);
                Assert.AreEqual(2, appearance.ExitAnimation.Count);
                Assert.AreEqual(false, appearance.Topmost);
            }
        }
예제 #2
0
        public void TestCreateCalmJenkinsOnJaJP()
        {
            // when
            Butler butler = ButlerFactory.CreateCalmJenkins();

            // then
            Assert.AreEqual(ButlerFactory.CalmJenkins, butler.Name);
            Assert.AreEqual(Resources.Nickname_CalmJenkins, butler.Nickname);
            Assert.AreEqual(Resources.DisplayName_CalmJenkins, butler.DisplayName);
            Assert.AreEqual(Resources.License_CalmJenkins, butler.License);
            Assert.AreEqual(ButlerFactory.Happy, butler.TypicalAppearance);

            AssertDefaultProperties(butler);

            Assert.AreEqual(2, butler.Appearances.Count);
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Normal];
                AssertDefaultPropertiesOfCalmJenkins(appearance);

                Assert.AreEqual(null, appearance.MessageText);
                Assert.AreEqual(Resources.Message_Report, appearance.BalloonTipText);
                Assert.AreEqual(Resources.BalloonTip_Title, appearance.BalloonTipTitle);
            }
            {
                Appearance appearance = butler.Appearances[ButlerFactory.Happy];
                AssertDefaultPropertiesOfCalmJenkins(appearance);

                Assert.AreEqual(Resources.Message_Report, appearance.MessageText);
                Assert.AreEqual(null, appearance.BalloonTipText);
                Assert.AreEqual(null, appearance.BalloonTipTitle);
            }
        }
예제 #3
0
        public void TestReadReport()
        {
            // setup
            ButlersFolder.Initialize("xxx");
            Report report = new Report();

            report.Hashtable["CurrentGrade"] = -1;

            {
                // when
                Butler butler = Butler.GetInstance(ButlerFactory.CalmJenkins);
                butler.ReadReport(report);

                // then
                Assert.AreSame(butler.GetAppearance(ButlerFactory.Happy).Image, butler.Image);
            }

            {
                // when
                Butler butler = Butler.GetInstance(ButlerFactory.EmotionalJenkins);
                butler.ReadReport(report);

                // then
                Assert.AreSame(butler.GetAppearance(ButlerFactory.Sad).Image, butler.Image);
            }
        }
예제 #4
0
        internal static Butler CreateDefaultButler(string name, string nickname, string displayName)
        {
            Butler butler = new Butler()
            {
                Name              = name,
                Nickname          = nickname,
                DisplayName       = displayName,
                License           = Resources.License_EmotionalJenkins,
                TypicalAppearance = ButlerFactory.Sad
            };

            butler.Appearances[ButlerFactory.Normal] =
                new Appearance(null, null, Resources.Message_Report, null, Resources.jenkins);

            butler.Appearances[ButlerFactory.Sad] =
                new Appearance(null, null, Resources.Message_Report, "sad.png", Resources.sad);

            butler.Appearances[ButlerFactory.Angry] =
                new Appearance(null, null, Resources.Message_Report, "oni.png", Resources.oni);

            butler.Appearances[ButlerFactory.Rageful] =
                new Appearance(null, null, Resources.Message_Report, "onibi.png", Resources.onibi);

            butler.Appearances[ButlerFactory.Expectant] =
                new Appearance(null, null, Resources.Message_Report, "ninja.png", Resources.ninja, false);

            butler.Appearances[ButlerFactory.Happy] =
                new Appearance(null, null, Resources.Message_Report, null, Resources.jenkins);

            butler.Appearances[ButlerFactory.Rageful].Topmost = true;
            SetNinjaAnimation(butler.Appearances[Expectant]);
            return(butler);
        }
예제 #5
0
        public void TestGetInstance()
        {
            // setup
            ButlersFolder.Initialize("xxx");
            Assert.IsTrue(Directory.Exists(ButlersFolder.GetFolder("xxx")));

            {
                // when
                Butler butler = Butler.GetInstance("test1");

                // then
                Assert.AreEqual("test1", butler.Name);
                Assert.AreEqual("test1", butler.DisplayName);
                Assert.AreEqual("test1", butler.Nickname);
                Assert.IsFalse(Directory.Exists(ButlersFolder.GetFolder("test1")));
            }

            {
                // when
                Butler butler = Butler.GetInstance(ButlerFactory.EmotionalJenkins);

                // then
                Assert.AreEqual(ButlerFactory.EmotionalJenkins, butler.Name);
            }
        }
예제 #6
0
 internal void Initialize()
 {
     this.report        = new Report();
     this.Configuration = Configuration.GetInstance();
     this.Butler        = Butler.GetInstance(this.Configuration.Butler);
     this.Business      = Business.GetInstance(this.Configuration.Business);
 }
예제 #7
0
 private static void AssertDefaultProperties(Butler butler)
 {
     Assert.AreEqual(false, butler.HasNews);
     Assert.AreEqual(null, butler.SourceUrl);
     Assert.AreEqual(null, butler.MessageText);
     Assert.AreEqual(null, butler.BalloonTipText);
     Assert.AreEqual(null, butler.BalloonTipTitle);
     Assert.AreEqual(false, butler.HasMessage);
     Assert.AreEqual(null, butler.TypicalAppearanceImage);
 }
예제 #8
0
        public void TestGetAppearance()
        {
            // setup
            Butler butler = ButlerFactory.CreateCalmJenkins();

            // expect
            Assert.AreSame(butler.Appearances[ButlerFactory.Normal], butler.GetAppearance(null));
            Assert.AreSame(butler.Appearances[ButlerFactory.Normal], butler.GetAppearance(""));
            Assert.AreSame(butler.Appearances[ButlerFactory.Normal], butler.GetAppearance("  "));
            Assert.AreSame(butler.Appearances[ButlerFactory.Normal], butler.GetAppearance("xx"));
            Assert.AreSame(butler.Appearances[ButlerFactory.Normal], butler.GetAppearance(ButlerFactory.Normal));
        }
예제 #9
0
        public void TestCreateEmotionalJenkins()
        {
            // when
            Butler butler = ButlerFactory.CreateEmotionalJenkins();

            // then
            Assert.AreEqual(ButlerFactory.EmotionalJenkins, butler.Name);
            Assert.AreEqual(Resources.Nickname_EmotionalJenkins, butler.Nickname);
            Assert.AreEqual(Resources.DisplayName_EmotionalJenkins, butler.DisplayName);
            Assert.AreEqual(Resources.License_EmotionalJenkins, butler.License);
            Assert.AreEqual(ButlerFactory.Sad, butler.TypicalAppearance);

            AssertEmotionalJenkinsProperties(butler);
        }
예제 #10
0
        public void TestSetErrorMessage()
        {
            {
                // when
                Butler butler = ButlerFactory.CreateEmotionalJenkins();
                butler.SetErrorMessage("message1", "logfile1");

                // then
                Assert.AreEqual(true, butler.HasNews);
                Assert.AreEqual(true, butler.HasMessage);
                Assert.AreEqual("logfile1", butler.SourceUrl);
                Assert.AreEqual("message1", butler.MessageText);
                Assert.AreEqual(null, butler.BalloonTipText);
                Assert.AreEqual(null, butler.BalloonTipTitle);
                Assert.AreEqual(null, butler.Icon);
                Assert.IsNotNull(butler.Image);
                Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
                Assert.AreEqual(10, butler.BalloonTipTimeout);
                Assert.AreEqual(false, butler.Topmost);
                Assert.IsNotNull(butler.MessageStyle);
                Assert.IsNotNull(butler.EnterAnimation);
                Assert.IsNotNull(butler.ExitAnimation);
            }
            {
                // when
                Butler butler = ButlerFactory.CreateCalmJenkins();
                butler.SetErrorMessage("message1", "logfile1");

                // then
                Assert.AreEqual(true, butler.HasNews);
                Assert.AreEqual(true, butler.HasMessage);
                Assert.AreEqual("logfile1", butler.SourceUrl);
                Assert.AreEqual("message1", butler.MessageText);
                Assert.AreEqual(null, butler.BalloonTipText);
                Assert.AreEqual(null, butler.BalloonTipTitle);
                Assert.AreEqual(null, butler.Icon);
                Assert.IsNotNull(butler.Image);
                Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
                Assert.AreEqual(10, butler.BalloonTipTimeout);
                Assert.AreEqual(false, butler.Topmost);
                Assert.IsNotNull(butler.MessageStyle);
                Assert.IsNotNull(butler.EnterAnimation);
                Assert.IsNotNull(butler.ExitAnimation);
            }
        }
예제 #11
0
        internal static Butler CreateCalmJenkins()
        {
            Butler butler = new Butler()
            {
                Name              = ButlerFactory.CalmJenkins,
                Nickname          = Resources.Nickname_CalmJenkins,
                DisplayName       = Resources.DisplayName_CalmJenkins,
                License           = Resources.License_CalmJenkins,
                TypicalAppearance = ButlerFactory.Happy
            };

            butler.Appearances[ButlerFactory.Normal] = new Appearance(
                Resources.BalloonTip_Title, Resources.Message_Report, null, null, Resources.jenkins);

            butler.Appearances[ButlerFactory.Happy] = new Appearance(
                null, null, Resources.Message_Report, null, Resources.jenkins);

            return(butler);
        }
예제 #12
0
        public void TestSetDefaultAppearance()
        {
            // setup
            Butler butler = ButlerFactory.CreateCalmJenkins();

            // when
            butler.SetDefaultAppearance();

            // then
            Assert.AreEqual(false, butler.HasNews);
            Assert.AreEqual(false, butler.HasMessage);
            Assert.AreEqual(null, butler.SourceUrl);
            Assert.AreEqual(null, butler.MessageText);
            Assert.AreEqual(null, butler.BalloonTipText);
            Assert.AreEqual(null, butler.BalloonTipTitle);
            Assert.AreEqual(null, butler.Icon);
            Assert.AreEqual(null, butler.Image);
            Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
            Assert.AreEqual(10, butler.BalloonTipTimeout);
            Assert.AreEqual(false, butler.Topmost);
            Assert.IsNotNull(butler.MessageStyle);
            Assert.IsNotNull(butler.EnterAnimation);
            Assert.IsNotNull(butler.ExitAnimation);
        }
예제 #13
0
        public void TestUpdateAppearance()
        {
            // setup
            Report report = CreateReport();

            {
                // when
                Butler butler = ButlerFactory.CreateEmotionalJenkins();
                butler.UpdateAppearance(ButlerFactory.Sad, report);

                // then
                Assert.AreEqual(true, butler.HasNews);
                Assert.AreEqual(true, butler.HasMessage);
                Assert.AreEqual("http://localhost/", butler.SourceUrl);
                Assert.AreEqual("aaa bbb", butler.MessageText);
                Assert.AreEqual(null, butler.BalloonTipText);
                Assert.AreEqual(null, butler.BalloonTipTitle);
                Assert.AreEqual(null, butler.Icon);
                Assert.AreEqual(null, butler.Image);
                Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
                Assert.AreEqual(10, butler.BalloonTipTimeout);
                Assert.AreEqual(false, butler.Topmost);
                Assert.IsNotNull(butler.MessageStyle);
                Assert.IsNotNull(butler.EnterAnimation);
                Assert.IsNotNull(butler.ExitAnimation);

                // when
                butler.UpdateAppearance(ButlerFactory.Rageful, report);

                // then
                Assert.AreEqual(true, butler.HasNews);
                Assert.AreEqual(true, butler.HasMessage);
                Assert.AreEqual("http://localhost/", butler.SourceUrl);
                Assert.AreEqual("aaa bbb", butler.MessageText);
                Assert.AreEqual(null, butler.BalloonTipText);
                Assert.AreEqual(null, butler.BalloonTipTitle);
                Assert.AreEqual(null, butler.Icon);
                Assert.AreEqual(null, butler.Image);
                Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
                Assert.AreEqual(10, butler.BalloonTipTimeout);
                Assert.AreEqual(true, butler.Topmost);
                Assert.IsNotNull(butler.MessageStyle);
                Assert.IsNotNull(butler.EnterAnimation);
                Assert.IsNotNull(butler.ExitAnimation);
            }
            {
                // when
                Butler butler = ButlerFactory.CreateCalmJenkins();
                butler.UpdateAppearance(ButlerFactory.Normal, report);

                // then
                Assert.AreEqual(true, butler.HasNews);
                Assert.AreEqual(false, butler.HasMessage);
                Assert.AreEqual("http://localhost/", butler.SourceUrl);
                Assert.AreEqual(null, butler.MessageText);
                Assert.AreEqual("aaa bbb", butler.BalloonTipText);
                Assert.AreEqual("ccc", butler.BalloonTipTitle);
                Assert.AreEqual(null, butler.Icon);
                Assert.AreEqual(null, butler.Image);
                Assert.AreEqual(ToolTipIcon.None, butler.ToolTipIcon);
                Assert.AreEqual(10, butler.BalloonTipTimeout);
                Assert.AreEqual(false, butler.Topmost);
                Assert.IsNotNull(butler.MessageStyle);
                Assert.IsNotNull(butler.EnterAnimation);
                Assert.IsNotNull(butler.ExitAnimation);
            }
        }