Ejemplo n.º 1
0
        public void GetCommandItemsReturnsOneItemWhenDBHasNObject()
        {
            //ARRANGE
            var command = new Command()
            {
                HowTo       = "do Something",
                Platform    = "Some Platform",
                CommandLine = "Some Command"
            };

            var command2 = new Command()
            {
                HowTo       = "do Something",
                Platform    = "Some Platform",
                CommandLine = "Some Command"
            };

            dbContext.Add(command);
            dbContext.Add(command2);
            dbContext.SaveChanges();

            //ACT
            var result = controller.GetCommandItems();

            //Assert
            Assert.Equal(2, result.Value.Count());
        }
Ejemplo n.º 2
0
 public void Create(T t)
 {
     if (t == null)
     {
         throw new ArgumentNullException(nameof(t));
     }
     _commandContext.Add(t);
 }
        public void GetCommandItems_ReturnsOneItem_WhenDBHasOneItem( )
        {
            // Arrange
            var command = new Command
            {
                HowTo       = "Do Something",
                Platform    = "Test 1.2",
                CommandLine = "Some CommandLine"
            };

            _dbContext.Add(command);
            _dbContext.SaveChanges( );

            // Act
            var results = _controller.GetCommandItems( );

            //Assert
            Assert.Single(results.Value);
        }