public void SaveContent(Content content, FakeContentRepo repo) { Content = repo.Content; Content.Add(content); //int index = Content.IndexOf(content); //Find the content at the specified index and then update it to have the new //value passed in the parameter above. // JUST FOR TESTING. INDEX IS HARD-CODED. Content[0].CurrentText = content.NewText; }
public void TestGetContent() { //Arrange FakeContentRepo repo = new FakeContentRepo(); Content testContent = new Content(); testContent.ContentID = "Test"; testContent.CurrentText = "This is a test statement."; //Act repo.AddContent(testContent); //Arrange Assert.AreSame(testContent.ContentID, repo.GetContent(testContent.ContentID).ContentID); Assert.AreSame(testContent.CurrentText, repo.GetContent(testContent.ContentID).CurrentText); }
public void TestUpdateContent() { //Arrange FakeContentRepo repo = new FakeContentRepo(); Content testContent1 = new Content(); testContent1.ContentID = "Test1"; testContent1.CurrentText = "This text was originally for TestContent1"; Content testContent2 = new Content(); testContent2.ContentID = "Test2"; testContent2.CurrentText = "This text was originally for TestContent2"; testContent2.NewText = testContent1.CurrentText; //Act repo.AddContent(testContent1); repo.AddContent(testContent2); testContent2.UpdateSection(); //Assert Assert.AreSame(testContent1.CurrentText, testContent2.CurrentText); }