Exemple #1
0
        public int SaveTestData(TestDataDto testData, string userId)
        {
            var id = -1;

            using (var dataContext = dataContextFactory.Create())
            {
                id = dataContext.TestDataSave(testData, userId);
            }
            return(id);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public int TestDataSave(TestDataDto testDataToSave, string userId)
        {
            var testDataSaved = new TestData
            {
                TestString = testDataToSave.TestString,
                UserId     = userId
            };

            TestData.Add(testDataSaved);
            SaveChanges();
            return(testDataSaved.Id);
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        public int Save(TestDataDto testData, string userId)
        {
            var id = testDataRepository.SaveTestData(testData, userId);

            return(id);
        }