Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
 }