Пример #1
0
        public void Test_GetById_ForNotExistingEntity()
        {
            // Arrange
            var repository = new SampleEntityRepository();

            // Act
            var notExistingEntity = repository.Get(1);

            // Assert
            Assert.Null(notExistingEntity);
        }
Пример #2
0
        public void Test_GetById_ForExistingEntity()
        {
            // Arrange
            var repository = new SampleEntityRepository();
            var newEntity  = new SampleEntity(1, Guid.NewGuid().ToString());

            repository.ExportedListForTest.Add(newEntity);

            // Act
            var savedEntity = repository.Get(newEntity.Id);

            // Assert
            Assert.NotNull(savedEntity);
            Assert.Equal(savedEntity.Id, newEntity.Id);
            Assert.Equal(savedEntity.Name, newEntity.Name);
        }