コード例 #1
0
ファイル: ProfileRepoTest.cs プロジェクト: lulzzz/DocumentsKM
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.profiles);
            var repo    = new SqlProfileRepo(context);

            // Act
            var profile = repo.GetById(999);

            // Assert
            Assert.Null(profile);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
コード例 #2
0
ファイル: ProfileRepoTest.cs プロジェクト: lulzzz/DocumentsKM
        public void GetAllByProjectId_ShouldReturnEmptyArray_WhenWrongProjectId()
        {
            // Arrange
            var context = GetContext(TestData.profiles);
            var repo    = new SqlProfileRepo(context);

            // Act
            var profiles = repo.GetAllByProfileClassId(999);

            // Assert
            Assert.Empty(profiles);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
コード例 #3
0
ファイル: ProfileRepoTest.cs プロジェクト: lulzzz/DocumentsKM
        public void GetById_ShouldReturnprofile()
        {
            // Arrange
            var context = GetContext(TestData.profiles);
            var repo    = new SqlProfileRepo(context);

            int id = _rnd.Next(1, TestData.profiles.Count());

            // Act
            var profile = repo.GetById(id);

            // Assert
            Assert.Equal(TestData.profiles.SingleOrDefault(v => v.Id == id), profile);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
コード例 #4
0
ファイル: ProfileRepoTest.cs プロジェクト: lulzzz/DocumentsKM
        public void GetAllByProfileClassId_ShouldReturnprofiles()
        {
            // Arrange
            var context = GetContext(TestData.profiles);
            var repo    = new SqlProfileRepo(context);

            int classId = _rnd.Next(1, TestData.profileClasses.Count());

            // Act
            var profiles = repo.GetAllByProfileClassId(classId);

            // Assert
            Assert.Equal(TestData.profiles.Where(v => v.Class.Id == classId), profiles);

            context.Database.EnsureDeleted();
            context.Dispose();
        }