Пример #1
0
        public async Task CreateIfNotExistTest()
        {
            T expected = TestSample.Get <T>();

            KAssert.DeepEqual(expected, await _repository.CreateIfNotExists(TestSample.Get <T>()));
            await _repository.Delete(TestSample.Get <T>());

            KAssert.DeepEqual(expected, await _repository.CreateIfNotExists(TestSample.Get <T>()));
        }
Пример #2
0
        public async Task CreateTest()
        {
            await Assert.ThrowsAsync <DuplicatedItemException>(() => _repository.Create(TestSample.Get <T>()));

            await _repository.Delete(TestSample.Get <T>());

            T expected = TestSample.Get <T>();

            expected.ID = 0;
            await _repository.Create(expected);

            KAssert.DeepEqual(expected, await _repository.Get(expected.Slug));
        }
Пример #3
0
        public async Task GetBySlugTest()
        {
            T value = await _repository.Get(TestSample.Get <T>().Slug);

            KAssert.DeepEqual(TestSample.Get <T>(), value);
        }
Пример #4
0
 public async Task GetExpressionSlugTest()
 {
     KAssert.DeepEqual(TestSample.Get <T>(), await _repository.Get(x => x.Slug == TestSample.Get <T>().Slug));
 }
Пример #5
0
 public async Task GetExpressionIDTest()
 {
     KAssert.DeepEqual(TestSample.Get <T>(), await _repository.Get(x => x.ID == TestSample.Get <T>().ID));
 }