Example #1
0
        public void Delete_N_WithNonExistingConfigId_ThrowsException()
        {
            // Arrange
            var configToDelete = new TestNetworkConfiguration()
            {
                Id = 123
            };

            // Act
            _service.Delete(configToDelete);
        }
Example #2
0
        public void Update_WithNonExistingConfig_ThrowsException()
        {
            // Arrange
            var configToUpdate = new TestNetworkConfiguration()
            {
                Id = 123
            };

            // Act
            _service.Update(configToUpdate);
        }
Example #3
0
        public void Delete_N_AfterDisposed_ThrowsException()
        {
            // Arrange
            var configToDelete = new TestNetworkConfiguration()
            {
                Id = 123
            };

            _service.Dispose();

            // Act
            _service.Delete(configToDelete);
        }
Example #4
0
        public void Add_NetworkConfiguration_AfterDisposed_ThrowsException()
        {
            // Arrange
            var configToAdd = new TestNetworkConfiguration()
            {
                Id = 123
            };

            _service.Dispose();

            // Act
            _service.Add(configToAdd);
        }
Example #5
0
        public void GetConfigurations_WithValidRepository_ReturnsConfigurations()
        {
            // Arrange
            var configToAdd = new TestNetworkConfiguration(999);

            _repository.Add(configToAdd);

            // Act
            var networkConfigs = _service.GetConfigurations();

            // Assert
            Assert.IsNotNull(networkConfigs);
            Assert.IsTrue(networkConfigs.Count() == 1);
        }
Example #6
0
        public void Add_NetworkConfiguration_WithValidNetworkConfiguration_AddsNetworkConfigurationToRepository()
        {
            // Arrange
            var configToAdd = new TestNetworkConfiguration()
            {
                Id = 123
            };

            // Act
            _service.Add(configToAdd);

            var addedConfiguration = _service.FindConfiguration(configToAdd.Id);

            // Assert
            Assert.IsTrue(addedConfiguration == configToAdd);
        }
Example #7
0
        public void FindConfiguration_WithInvalidId_ReturnsNull()
        {
            // Arrange
            var configToAdd = new TestNetworkConfiguration()
            {
                Id = 123
            };

            _repository.Add(configToAdd);

            // Act
            var networkConfig = _service.FindConfiguration(234);

            // Assert
            Assert.IsNull(networkConfig);
        }
Example #8
0
        public void Update_WithExistingValidConfig_UpdatesConfigInRepository()
        {
            // Arrange
            var configToUpdate = new TestNetworkConfiguration()
            {
                Id = 123
            };

            _service.Add(configToUpdate);

            // Act
            configToUpdate.Id = 234;
            _service.Update(configToUpdate);

            // Assert
            Assert.IsTrue(configToUpdate.Id == 234);
        }
Example #9
0
        public void Delete_N_WithValidConfigId_DeletesConfigInRepository()
        {
            // Arrange
            var configToDelete = new TestNetworkConfiguration()
            {
                Id = 123
            };

            _service.Add(configToDelete);

            // Act
            _service.Delete(configToDelete);

            var deletedConfig = _service.FindConfiguration(configToDelete.Id);

            // Assert
            Assert.IsNull(deletedConfig);
        }
Example #10
0
        public void FindConfiguration_WithValidId_ReturnsNetworkConfiguration()
        {
            // Arrange
            var id          = 123;
            var configToAdd = new TestNetworkConfiguration()
            {
                Id = id
            };

            _repository.Add(configToAdd);

            // Act
            var networkConfig = _service.FindConfiguration(id);

            // Assert
            Assert.IsNotNull(networkConfig);
            Assert.IsTrue(networkConfig == configToAdd);
        }