public void AddSameActivityShouldFail() { // Arrange var activity = new TimelineActivityMother().Build(); var timeline = new TimelineMother().Build(); var originalCount = timeline.GetActivities().Count; const int expectedCount = 1; // Act try { timeline.AddActivity(activity); timeline.AddActivity(activity); }catch (Exception) { var actualCount = timeline.GetActivities().Count; // Assert Assert.AreEqual(expectedCount, actualCount); throw; } }
public void GetActivityTest() { // Arrange var activity = new TimelineActivityMother().Build(); var timeline = new TimelineMother().Build(); timeline.AddActivity(activity); // Act var actual = timeline.GetActivity(activity.Id); // Assert Assert.AreSame(activity, actual); }
public void AddActivityTest() { // Arrange var activity = new TimelineActivityMother().Build(); var timeline = new TimelineMother().Build(); var originalCount = timeline.GetActivities().Count; const int expectedCount = 1; // Act timeline.AddActivity(activity); var actual = timeline.GetActivity(activity.Id); var actualCount = timeline.GetActivities().Count; // Assert Assert.IsNotNull(actual); Assert.AreEqual(expectedCount, actualCount); Assert.AreNotEqual(originalCount, actualCount); }