public void GetTopic_ExistentTopic_ShouldReturnSpecificTopicFromDB() { topicRepositoryInMemory.Add(oneTopic); topicRepositoryInMemory.Add(anotherTopic); topicRepositoryInMemory.SaveChanges(); Assert.AreEqual(topicRepositoryInMemory.Get(oneTopic.Id), oneTopic); }
public TopicDetailModel Save(TopicDetailModel model) { if (model.Id == Guid.Empty) { return(repository.Add(model)); } else { repository.Update(model); return(model); } }
public IActionResult Create(FileUpload fileObj) { Topic oTopic = JsonConvert.DeserializeObject <Topic>(fileObj.Entity); if (fileObj.File.Length > 0) { using (var memoryStream = new MemoryStream()) { fileObj.File.CopyTo(memoryStream); var fileBytes = memoryStream.ToArray(); oTopic.Image = fileBytes; _topicRepository.Add(oTopic); return(View()); } } return(View()); }
public void TestFindTopicByName() { topicRepository.Add(topic); Assert.AreEqual("Test", topicRepository.FindTopicByName("Test").Description); topicRepository.Delete(topic); }
public List <TopicVM> Add(Topic item) { tr.Add(item); return(ListTopics()); }