Ejemplo n.º 1
0
        public void DataFileTest_LoadBeepsDataTable_BeepDataTable()
        {
            var mf = new MainForm();

            mf.Show();

            var d = new XmlDocument();

            d.PreserveWhitespace = false;
            d.LoadXml(@"	<BeepsDataTable>
<DocumentElement>
  <Beeps>
    <MsBeforeRinging>400</MsBeforeRinging>
    <BeepDuration>500</BeepDuration>
    <BeepFrequency>600</BeepFrequency>
  </Beeps>
  <Beeps>
    <MsBeforeRinging>100</MsBeforeRinging>
    <BeepDuration>200</BeepDuration>
    <BeepFrequency>300</BeepFrequency>
  </Beeps>
</DocumentElement>
	</BeepsDataTable>"    );

            var dt = new BeepDataTable();

            dt.LoadFromString(d.DocumentElement.InnerXml);

            mf.MyDataFile.LoadBeepsDataTable(dt);

            Assert.AreEqual(Utils.RemoveWhitespaceFromXML(mf.MyDataFile.GetBeepsDataTable()),
                            d.DocumentElement.InnerXml);

            Assert.AreEqual("", mf.MyDataFile.ErrorString);
        }
Ejemplo n.º 2
0
        public void TimerDataTest_UpdateBeepTimers()
        {
            // Arrange
            cs_timed_silver.Properties.Settings.Default.AutoOpenLastFile = "No";
            var mf = new MainForm();

            mf.OnLoadCreateBasicViewDataWithView = false;
            mf.OnLoadUpdateViewType = false;
            mf.Show();

            var dt = new BeepDataTable();

            dt.LoadFromString(@"	<BeepsDataTable>
<DocumentElement>
  <Beeps>
    <MsBeforeRinging>400</MsBeforeRinging>
    <BeepDuration>500</BeepDuration>
    <BeepFrequency>600</BeepFrequency>
  </Beeps>
  <Beeps>
    <MsBeforeRinging>100</MsBeforeRinging>
    <BeepDuration>200</BeepDuration>
    <BeepFrequency>300</BeepFrequency>
  </Beeps>
</DocumentElement>
	</BeepsDataTable>"    );
            mf.MyDataFile.LoadBeepsDataTable(dt);

            // Act
            var td = new TimerData(mf.MyDataFile, mf.MultiAudioPlayer)
            {
                CurrentTimeSpan = TimeSpan.FromSeconds(15.591)
            };

            td.UpdateBeepTimers();

            Assert.AreEqual(2, td.MyBeepTimers.BeepDurations.Length);
            Assert.AreEqual(2, td.MyBeepTimers.BeepFrequecies.Length);
            Assert.AreEqual(2, td.MyBeepTimers.BeepMsBeforeRinging.Length);
            Assert.AreEqual(2, td.MyBeepTimers.BeepTimers.Length);
        }