public int SaveTestData(TestDataDto testData, string userId) { var id = -1; using (var dataContext = dataContextFactory.Create()) { id = dataContext.TestDataSave(testData, userId); } return(id); }
public int SaveTestData(TestDataDto testData, string userId) { var testDataForSave = new DataAccessLayer.TestData { Id = testDataStorage.Count, TestString = testData.TestString, UserId = userId }; testDataStorage.Add(testDataForSave); return(testDataForSave.Id); }
public int TestDataSave(TestDataDto testDataToSave, string userId) { var testDataSaved = new TestData { TestString = testDataToSave.TestString, UserId = userId }; TestData.Add(testDataSaved); SaveChanges(); return(testDataSaved.Id); }
public void DataCanBeGet() { var userId = "0000-0000-0000-0000"; var testString = "test string content"; var testData = new TestDataDto { TestString = testString }; var savedId = TestDataRepository.SaveTestData(testData, userId); var gettedData = TestDataService.GetBy(savedId); Assert.AreEqual(gettedData, TestDataRepository.GetTestDataById(savedId)); }
public void DataReallySaved() { var userId = "0000-0000-0000-0000"; var testString = "test string content"; var testData = new TestDataDto { TestString = testString }; var savedId = TestDataService.Save(testData, userId); var expectedData = new DataAccessLayer.TestData { Id = savedId, TestString = testString, UserId = userId }; Assert.AreEqual(TestDataRepository.GetTestDataById(savedId), expectedData); }
public int Save(TestDataDto testData, string userId) { var id = testDataRepository.SaveTestData(testData, userId); return(id); }