Exemple #1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.profileTypes);
            var repo    = new SqlProfileTypeRepo(context);

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

            // Assert
            Assert.Null(profileType);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Exemple #2
0
        public void GetById_ShouldReturnProfileType()
        {
            // Arrange
            var context = GetContext(TestData.profileTypes);
            var repo    = new SqlProfileTypeRepo(context);

            var id = _rnd.Next(1, TestData.profileTypes.Count());

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

            // Assert
            Assert.Equal(TestData.profileTypes.SingleOrDefault(v => v.Id == id),
                         profileType);

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