public void EditTickMarkTest() { TimeLine tline = new TimeLine("Test"); List<TickMark> ticklist = tline.GetTicks(); TickMark tick = ticklist.First(); Assert.AreEqual(0, tick.GetXPlacement()); tick.EditTickLocation(100, tline.GetID()); Assert.AreEqual(100, tick.GetXPlacement()); Assert.AreEqual("Test", tick.GetName()); tick.EditTickName("NewName", tline.GetID()); Assert.AreEqual("NewName", tick.GetName()); TimeLine testline = new TimeLine("Test"); List<TickMark> testticklist = testline.GetTicks(); TickMark testtick = testticklist.First(); Assert.AreEqual(100, testtick.GetXPlacement()); Assert.AreEqual("NewName", testtick.GetName()); tick.EditTickName("Test", tline.GetID()); tick.EditTickLocation(0, tline.GetID()); Assert.AreEqual(0, tick.GetXPlacement()); Assert.AreEqual("Test", tick.GetName()); }
public void ClearTickMarkTest() { TimeLine tline = new TimeLine("Test"); TickMark tick = new TickMark("Test", 0); tline.ClearTicks(); List<TickMark> test = tline.GetTicks(); Assert.AreEqual(0, test.Count()); tline.NewTickMark(tick); Assert.AreEqual(1, test.Count()); }
public void TimeLineTest() { TimeLine timeline = new TimeLine("Test"); TickMark tick = new TickMark("Test", 0); Assert.AreEqual(13, timeline.GetID()); Assert.AreEqual(Convert.ToDateTime("1/1/1900 12:00:00 AM"), timeline.GetStartDate()); Assert.AreEqual(Convert.ToDateTime("1/1/1900 12:00:00 AM"), timeline.GetEndDate()); Assert.AreEqual(1, timeline.GetTicks().Count()); TickMark first = timeline.GetTicks().First(); Assert.AreEqual(tick.GetName(), first.GetName()); Assert.AreEqual(tick.GetXPlacement(), first.GetXPlacement()); }
public void CreateandDeleteTickMarkTest() { TimeLine tline = new TimeLine("Test"); TickMark tick = new TickMark("NEWTest", 0); List<TickMark> ticklist = tline.GetTicks(); Assert.AreEqual(1, ticklist.Count()); Assert.IsTrue(tline.NewTickMark(tick)); ticklist = tline.GetTicks(); Assert.AreEqual(2, ticklist.Count()); Assert.IsTrue(tline.DeleteTickMark(tick)); ticklist = tline.GetTicks(); Assert.AreEqual(1, ticklist.Count()); }
public void RoadMapTest() { RoadMap map = new RoadMap("Test"); Assert.AreEqual("TEST", map.GetDecription()); Assert.AreEqual("Test", map.GetName()); Assert.AreEqual("10/6/2015 1:53:46 PM", map.GetTimeStamp().ToString()); Assert.AreEqual("123", map.GetUser().GetUserName()); TimeLine timeline = new TimeLine("Test"); TimeLine test = map.GetTimeline(); Assert.AreEqual( timeline.GetID(), test.GetID()); StrategyPoint sp = new StrategyPoint("Test", "TEST"); List<StrategyPoint> spTest = map.GetStrategyPoints(); Assert.AreEqual(sp.GetName(), spTest.First().GetName()); }
public void EditTimeLineTest() { TimeLine timeline = new TimeLine("Test"); DateTime test = DateTime.Now; timeline.EditStartDate(test, "test"); Assert.AreEqual(test.ToString(), timeline.GetStartDate().ToString()); timeline.EditEndDate(test, "test"); Assert.AreEqual(test.ToString(), timeline.GetEndDate().ToString()); TimeLine testtimeline = new TimeLine("test"); Assert.AreEqual(test.ToString(), testtimeline.GetStartDate().ToString()); Assert.AreEqual(test.ToString(), testtimeline.GetEndDate().ToString()); timeline.EditStartDate(Convert.ToDateTime("1/1/1900 12:00:00 AM"), "test"); Assert.AreEqual("1/1/1900 12:00:00 AM", timeline.GetStartDate().ToString()); timeline.EditEndDate(Convert.ToDateTime("1/1/1900 12:00:00 AM"), "test"); Assert.AreEqual("1/1/1900 12:00:00 AM", timeline.GetEndDate().ToString()); }
//CONSTRUCTOR public RoadMap( string name ) { mName = name; string UID; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT Timestamp, Description, UserID, color_dep_of, color_dep_on FROM [dbo].[Roadmap] WHERE Name =@Rname"; cmd.Parameters.AddWithValue("@Rname", name); cmd.Connection = conn; conn.Open(); using (SqlDataReader Reader = cmd.ExecuteReader()) { Reader.Read(); mTimeStamp = Reader.GetDateTime(0); mDescription = Reader.GetString(1); UID = Reader.GetString(2); try { mColor_of = Reader.GetString(3); mColor_on = Reader.GetString(4); } catch { mColor_of = "#ffff00"; mColor_on = "#ff66ff"; } } } using (SqlCommand cmd1 = new SqlCommand()) { cmd1.CommandText = "SELECT Name, Email, Password FROM [dbo].[User] WHERE ID = @User"; cmd1.Parameters.AddWithValue("@User", UID); cmd1.Connection = conn; using (SqlDataReader Reader = cmd1.ExecuteReader()) { Reader.Read(); mUser = new User(Reader.GetString(0), UID, Reader.GetString(1), Reader.GetString(2)); } } mTimeline = new TimeLine(mName); //Get the StrategyPoints using (SqlCommand cmd3 = new SqlCommand()) { cmd3.CommandText = "SELECT Name, Description FROM [dbo].[StrategyPoint] WHERE RoadmapName =@Rname ORDER BY SORT ASC"; cmd3.Parameters.AddWithValue("@Rname", mName); cmd3.Connection = conn; using (SqlDataReader Reader = cmd3.ExecuteReader()) { while (Reader.Read()) { StrategyPoint sp = new StrategyPoint(Reader.GetString(0), Reader.GetString(1), name); mStrategyPoints.Add(sp); } } } conn.Close(); } }
//Creates timeline with Name=name public bool CreateTimeLine(string name) { bool toReturn; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "INSERT INTO [dbo].[Timeline] (Name, StartDate, EndDate, RoadmapName ) VALUES ( @Tname, @sdate, @edate, @Rname)"; cmd.Parameters.AddWithValue("@Tname", name); cmd.Parameters.AddWithValue("@sdate", DateTime.Now); cmd.Parameters.AddWithValue("@edate", DateTime.Now.AddYears(1)); cmd.Parameters.AddWithValue("@Rname", mName); cmd.Connection = conn; toReturn = false; conn.Open(); if (cmd.ExecuteNonQuery()!=0) { mTimeline = new TimeLine(name); toReturn = true; } conn.Close(); } } return toReturn; }