コード例 #1
0
        public async Task GetByName_NullArgument_ShouldReturnNull()
        {
            // arrange
            var context = await InitializeContext();

            var repository = new Application.Repository.Tag.TagRepository(context);

            //act
            var result = await repository.GetByNameLike(null);

            //assert
            Assert.Null(result);

            //clean
            DisposeContext(context);
        }
コード例 #2
0
        public async Task Take_ValidArgument_InCollectionRange_ShouldReturnEmptyList()
        {
            // arrange
            var context = await InitializeContext();

            var repository   = new Application.Repository.Tag.TagRepository(context);
            var argument     = 2;
            var expectedSize = 2;

            //act
            var result = await repository.Take(argument);

            //assert
            Assert.AreEqual(expectedSize, result.Count());

            //clean
            DisposeContext(context);
        }
コード例 #3
0
        public async Task GetRandom_TooHighArgument_ShouldReturnFullList()
        {
            // arrange
            var context = await InitializeContext();

            var repository   = new Application.Repository.Tag.TagRepository(context);
            var argument     = 10;
            var expectedSize = 3;

            //act
            var result = await repository.GetRandom(argument);

            //assert
            Assert.AreEqual(expectedSize, result.Count());

            //clean
            DisposeContext(context);
        }
コード例 #4
0
        public async Task GetByName_ValidArgument_BadLetterCase_ShouldReturnPropertyObject()
        {
            // arrange
            var context = await InitializeContext();

            var    repository = new Application.Repository.Tag.TagRepository(context);
            string name       = "waRSaw";
            int    expectedId = 1;

            //act
            var result = await repository.GetByNameLike(name);

            //assert
            Assert.NotNull(result);
            Assert.AreEqual(expectedId, result.Id);

            //clean
            DisposeContext(context);
        }
コード例 #5
0
        public async Task GetByName_MatchedArgument()
        {
            // arrange
            var context = await InitializeContext();

            var    repository = new Application.Repository.Tag.TagRepository(context);
            string name       = "Warsaw";
            int    expectedId = 1;

            //act
            var result = await repository.GetByNameLike(name);

            //assert
            Assert.NotNull(result);
            Assert.AreEqual(expectedId, result.Id);

            //clean
            DisposeContext(context);
        }