public void Create_Case01_ud() { // Arrange // Act var pd = SdParamData.Create("ud"); // Assert Assert.That(pd.RawData, Is.EqualTo("ud")); Assert.That(pd, Is.InstanceOf <SdParamData.UndefinedSdParamData>()); }
public void Create_Case01_en() { // Arrange // Act var pd = SdParamData.Create("en"); // Assert Assert.That(pd.RawData, Is.EqualTo("en")); Assert.That(pd, Is.InstanceOf <SdParamData.EntrySdParamData>()); }
public void Create_Case55_d_at() { // Arrange // Act var pd = SdParamData.Create("@1"); var casted = pd as SdParamData.DaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("@1")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.Day, Is.EqualTo(1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.NonBusinessDay)); }
public void Create_Case22_yyyymd_star() { // Arrange // Act var pd = SdParamData.Create("2018/6/*1"); var casted = pd as SdParamData.DaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/6/*1")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.BusinessDay)); }
public void Create_Case12_yyyymd_plus() { // Arrange // Act var pd = SdParamData.Create("2018/6/+1"); var casted = pd as SdParamData.DaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/6/+1")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.Relative)); }
public void Create_Case52_d() { // Arrange // Act var pd = SdParamData.Create("1"); var casted = pd as SdParamData.DaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("1")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.Day, Is.EqualTo(1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.Absolute)); }
public void Create_Case41_mmdd() { // Arrange // Act var pd = SdParamData.Create("06/b-01"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("06/b-01")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(-1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.Absolute)); Assert.That(casted.ToString(), Is.EqualTo("6月末の1日前")); }
public void Create_Case31_yyyymmdd_at() { // Arrange // Act var pd = SdParamData.Create("2018/06/@b-01"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/06/@b-01")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(-1)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.NonBusinessDay)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月の休業日末日の1日前")); }
public void Create_Case63_b() { // Arrange // Act var pd = SdParamData.Create("b"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("b")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.Day, Is.EqualTo(0)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.InverseDaySdParamData.DayUnits.Absolute)); Assert.That(casted.ToString(), Is.EqualTo("当月末")); }
public void Create_Case73_b_plus() { // Arrange // Act var pd = SdParamData.Create("+b"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("+b")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.Day, Is.EqualTo(0)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.InverseDaySdParamData.DayUnits.Relative)); Assert.That(casted.ToString(), Is.EqualTo("当月の相対日末日")); }
public void Create_Case22_yyyymd_star() { // Arrange // Act var pd = SdParamData.Create("2018/6/*b-10"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/6/*b-10")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(-10)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.BusinessDay)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月の運用日末日の10日前")); }
public void Create_Case12_yyyymd_plus() { // Arrange // Act var pd = SdParamData.Create("2018/6/+b-10"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/6/+b-10")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(-10)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.DaySdParamData.DayUnits.Relative)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月の相対日末日の10日前")); }
public void Create_Case93_b_at() { // Arrange // Act var pd = SdParamData.Create("@b"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("@b")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.Day, Is.EqualTo(0)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.InverseDaySdParamData.DayUnits.NonBusinessDay)); Assert.That(casted.ToString(), Is.EqualTo("当月の休業日末日")); }
public void Create_Case82_mmb_star() { // Arrange // Act var pd = SdParamData.Create("06/*b"); var casted = pd as SdParamData.InverseDaySdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("06/*b")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.Day, Is.EqualTo(0)); Assert.That(casted.Unit, Is.EqualTo(SdParamData.InverseDaySdParamData.DayUnits.BusinessDay)); Assert.That(casted.ToString(), Is.EqualTo("6月の運用日末日")); }
public void Create_Case05_yyyymm_th() { // Arrange // Act var pd = SdParamData.Create("2018/06/th"); var casted = pd as SdParamData.DayOfWeekSdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/06/th")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.DayOfWeek, Is.EqualTo(DayOfWeek.Thursday)); Assert.That(casted.Relative, Is.False); Assert.That(casted.Number, Is.EqualTo(0)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月第1木曜日")); }
public void Create_Case33_yyyymm_su_colonb() { // Arrange // Act var pd = SdParamData.Create("2018/06/su:b"); var casted = pd as SdParamData.DayOfWeekSdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/06/su:b")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.DayOfWeek, Is.EqualTo(DayOfWeek.Sunday)); Assert.That(casted.Relative, Is.False); Assert.That(casted.Number, Is.EqualTo(-1)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月最終の日曜日")); }
public void Create_Case22_plus_yyyymm_mo() { // Arrange // Act var pd = SdParamData.Create("2018/06/+mo"); var casted = pd as SdParamData.DayOfWeekSdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("2018/06/+mo")); Assert.That(casted.Year, Is.EqualTo(2018)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.DayOfWeek, Is.EqualTo(DayOfWeek.Monday)); Assert.That(casted.Relative, Is.True); Assert.That(casted.Number, Is.EqualTo(0)); Assert.That(casted.ToString(), Is.EqualTo("2018年6月相対日の第1月曜日")); }
public void Create_Case12_mo() { // Arrange // Act var pd = SdParamData.Create("mo"); var casted = pd as SdParamData.DayOfWeekSdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("mo")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(0)); Assert.That(casted.DayOfWeek, Is.EqualTo(DayOfWeek.Monday)); Assert.That(casted.Relative, Is.False); Assert.That(casted.Number, Is.EqualTo(0)); Assert.That(casted.ToString(), Is.EqualTo("実行登録日直近の月曜日")); }
public void Create_Case11_mm_su() { // Arrange // Act var pd = SdParamData.Create("06/su"); var casted = pd as SdParamData.DayOfWeekSdParamData; // Assert Assert.That(casted.RawData, Is.EqualTo("06/su")); Assert.That(casted.Year, Is.EqualTo(0)); Assert.That(casted.Month, Is.EqualTo(6)); Assert.That(casted.DayOfWeek, Is.EqualTo(DayOfWeek.Sunday)); Assert.That(casted.Relative, Is.False); Assert.That(casted.Number, Is.EqualTo(0)); Assert.That(casted.ToString(), Is.EqualTo("6月第1日曜日")); }
public IEnumerable <RuleData> ExtractRuleData(IUnit jobnet) { foreach (var sdParam in jobnet.Parameters.Where(x => x.Name == "sd")) { var d = new RuleData(); d.Number = sdParam.Values.Count == 1 ? 1 : int.Parse(sdParam.Values[0].StringValue); d.SdParam = SdParamData.Create(sdParam.Values[sdParam.Values.Count - 1].StringValue); d.StParam = jobnet.ParameterNvl("st", d.Number, x => StParamData.Create(x.StringValue), StParamData.Default); d.CyParam = jobnet.ParameterNvl("cy", d.Number, x => CyParamData.Create(x.TupleValue), null); d.WcParam = jobnet.ParameterNvl("wc", d.Number, x => WcParamData.Create(x.StringValue), WcParamData.Default); d.WtParam = jobnet.ParameterNvl("wt", d.Number, x => WtParamData.Create(x.StringValue), WtParamData.Default); yield return(d); } }