public void DaimonButtonBox_DaimonIndexのテスト() { using (var test = new EPuzzleTestManager()) { test.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); test.Initialize(); var window = test.Window; var daimons = window.EPuzzleData.CurrentMondaiDocument.GetAllItems().OfType<Daimon>().ToArray(); foreach (var daimon in daimons) { test.Unlock(daimon); } window.State = new DaimonState(window, daimons[0]); { Assert.IsInstanceOf<DaimonState>(window.State); Assert.AreEqual("daimon1", ((DaimonState)window.State).Daimon.Id); var daimonButtonBox = window.State.GetAllItems().OfType<DaimonButtonBox>().First(); Assert.AreEqual(0, daimonButtonBox.DaimonIndex); } var nextButton = window.State.GetAllItems().OfType<NextButton>().First(); window.State.CurrentItem = nextButton; window.State.OnAction0(); test.AddTime(10d); window.Tick(); test.AddTime(10d); window.Tick(); { Assert.IsInstanceOf<DaimonState>(window.State); Assert.AreEqual("daimon2", ((DaimonState)window.State).Daimon.Id); var daimonButtonBox = window.State.GetAllItems().OfType<DaimonButtonBox>().First(); Assert.AreEqual(1, daimonButtonBox.DaimonIndex); } } }
public void DaimonButtonBoxでDaimon間を遷移() { using (var test = new EPuzzleTestManager()) { test.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); test.Initialize(); var window = test.Window; var userInfo = window.EPuzzleData.CurrentUserInfo; var daimons = window.EPuzzleData.CurrentMondaiDocument.GetAllItems().OfType<Daimon>().ToArray(); test.Unlock(daimons[0].Id); CollectionAssert.AreEqual(new [] { false, false, true, true, true, true, true }, daimons.Select(x => x.IsLocked(userInfo))); window.State = new DaimonState(window, daimons[0]); Assert.IsInstanceOf<DaimonState>(window.State); Assert.AreSame(daimons[0], ((DaimonState)window.State).Daimon); var daimonButtons = window.State.GetAllItems().OfType<DaimonButton>().ToArray(); window.State.CurrentItem = daimonButtons[1]; window.State.OnAction0(); test.AddTime(10d); window.Tick(); test.AddTime(10d); window.Tick(); Assert.IsInstanceOf<DaimonState>(window.State); Assert.AreSame(daimons[1], ((DaimonState)window.State).Daimon); } }
public void ヘルプの表示は初回のみ() { using (var testManager = new EPuzzleTestManager()) { testManager.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); testManager.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); testManager.AddFile(@"help\help0.png", fileName => new Bitmap(100, 100).Save(fileName, System.Drawing.Imaging.ImageFormat.Png)); testManager.Initialize(); var window = testManager.Window; var userInfo = window.EPuzzleData.CurrentUserInfo; var helpDocumentSet = window.EPuzzleData.HelpDocumentSet; Assert.NotNull(helpDocumentSet); Assert.AreEqual("name0", helpDocumentSet.GetItem("help0").Name); var daimon = (Daimon)window.EPuzzleData.MondaiDocuments[0].GetItem("daimon1"); var daimonState = new DaimonState(window, daimon); window.State = daimonState; var chumonButton = (ChumonButton)window.State.GetAllItems().OfType<ChumonButton>().First(); var chumon = (Chumon)chumonButton.Chumon; Assert.AreEqual("chumon1", chumon.Id); // クリア済み testManager.Unlock("chumon1"); window.State.CurrentItem = chumonButton; window.State.OnAction0(); testManager.AddTime(10); window.Tick(); testManager.AddTime(10); window.Tick(); Assert.IsInstanceOf<ClickDeKaishiState>(window.State); window.State.OnAction0(); // 情報ボタンの押下でヘルプページに遷移する Assert.IsInstanceOf<ShomonState>(window.State); var shomonState = (ShomonState)window.State; Assert.AreEqual(2, shomonState.Shomon.Parent.HelpIds.Count()); var infoButton = window.State.GetAllItems().First(x => "info" == x.Name); window.State.CurrentItem = infoButton; window.State.OnAction0(); Assert.IsInstanceOf<HelpItemState>(window.State); var helpItems = (HelpItemBase[])TestUtility.GetValue(window.State, "_helpItems"); Assert.AreEqual("help0", helpItems[0].Id); } }
public void Test1() { using (var test = new EPuzzleTestManager()) { test.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); test.Initialize(); var window = test.Window; var daimons = window.EPuzzleData.CurrentMondaiDocument.GetAllItems().OfType<Daimon>().ToArray(); Assert.AreEqual(7, daimons.Count()); var windowState = new WindowState(window); window.State = windowState; var userInfo = window.EPuzzleData.CurrentUserInfo; var daimonButtonBox = new DaimonButtonBox(daimons, 0, userInfo); CollectionAssert.AreEqual(daimons, daimonButtonBox.Daimons); Assert.AreEqual(0, daimonButtonBox.DaimonIndex); window.State.Items.Add(daimonButtonBox); var daimonButtons = daimonButtonBox.Items.OfType<DaimonButton>(); Assert.AreEqual(daimons.Count(), daimonButtons.Count()); Assert.True(daimonButtons.All(x => DrawingObjectFloating.Left == x.Floating)); daimonButtonBox.DaimonButtonSize = new SizeF(10, 20); Assert.True(daimonButtons.All(x => x.Size == new Size(10, 20))); daimonButtonBox.DaimonButtonMarginLeft = 8f; Assert.True(daimonButtons.All(x => x.MarginLeft == 8f)); daimonButtonBox.DaimonButtonMarginTop = 8f; Assert.True(daimonButtons.All(x => x.MarginTop == 8f)); daimonButtonBox.DaimonButtonMarginBottom = 8f; Assert.True(daimonButtons.All(x => x.MarginBottom == 8f)); // ボーダーライン表示 // Assert.True(daimonButtons.All(x => x.BorderLine)); daimonButtonBox.Refresh(); var daimonButton = daimonButtons.First(); Assert.AreEqual(daimonButton.OuterWidth * daimonButtons.Count() + daimonButtonBox.DaimonButtonMarginLeft, daimonButtonBox.Width); Assert.AreEqual(daimonButton.OuterHeight, daimonButtonBox.Height); // IsClickable CollectionAssert.AreEqual(new [] { false, false, false, false, false, false, false, }, daimonButtons.Select(x => x.IsClickable)); test.Unlock(daimons[0]); CollectionAssert.AreEqual(new [] { false, false, true, true, true, true, true, }, daimons.Select(x => x.IsLocked(userInfo))); daimonButtonBox.Refresh(); CollectionAssert.AreEqual(new [] { false, true, false, false, false, false, false, }, daimonButtons.Select(x => x.IsClickable)); CollectionAssert.AreEqual(new [] { true, false, true, true, true, true, true, }, daimonButtons.Select(x => x.Monochrome)); } }
public void Test0() { using (var test = new EPuzzleTestManager()) { test.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); test.Initialize(); var window = test.Window; var userInfo = window.EPuzzleData.CurrentUserInfo; var mondaiDocument = window.EPuzzleData.CurrentMondaiDocument; var daimons = mondaiDocument.Items.OfType<Daimon>().ToArray(); var daimon = daimons[0]; /* foreach (var item in daimons) { item.GradeProcessor = GradeProcessorA.Instance; } foreach (var item in daimon.Items) { item.GradeProcessor = GradeProcessorA.Instance; }*/ userInfo.GradeProcessor = GradeProcessorA.Instance; Assert.AreEqual(7, daimons.Count()); CollectionAssert.AreEqual(new [] { "-", "-", "-", "-", "-", "-", "-", }, daimons.Select(x => x.GetGradeString(userInfo))); var chumons = daimon.Items.OfType<Chumon>().ToArray(); Assert.AreEqual(2, chumons.Count()); { var chumon = chumons[0]; userInfo.MondaiResults.AddNew(chumon.Id, DateTime.MinValue, chumon.GetTimeLimit(userInfo).Multiply(10)); } CollectionAssert.AreEqual(new [] { "-", "-", "-", "-", "-", "-", "-", }, daimons.Select(x => x.GetGradeString(userInfo))); { var chumon = chumons[1]; userInfo.MondaiResults.AddNew(chumon.Id, DateTime.MinValue, chumon.GetTimeLimit(userInfo).Multiply(10)); } CollectionAssert.AreEqual(new [] { "D", "-", "-", "-", "-", "-", "-", }, daimons.Select(x => x.GetGradeString(userInfo))); test.Unlock(daimon); CollectionAssert.AreEqual(new [] { "S", "-", "-", "-", "-", "-", "-", }, daimons.Select(x => x.GetGradeString(userInfo))); } }