public void PostCommandItem_ItemCountIncremented_WhenUsingInvalidItem( )
        {
            // Arrange
            var command = new Command
            {
                HowTo       = "Do Something",
                Platform    = "Test 3.1",
                CommandLine = "Some CommandLine"
            };
            var oldCount = _dbContext.CommandItems.Count( );

            // Act
            var result = _controller.PostCommandItem(command);

            //Assert
            Assert.Equal(oldCount + 1, _dbContext.CommandItems.Count( ));
        }
        public void PostCommandItemObjectCountIncrementWhenValidObject()
        {
            //Arrange
            var command = new Command
            {
                HowTo       = "Do Somethting",
                Platform    = "Some Platform",
                CommandLine = "Some Command"
            };
            var oldCount = dbContext.CommandItems.Count();

            //Act
            var result = controller.PostCommandItem(command);

            //Assert
            Assert.Equal(oldCount + 1, dbContext.CommandItems.Count());
        }
Esempio n. 3
0
        public void PostCommandItem_ObjectCountIncrement_WhenValidObject()
        {
            //Action 3 Test : POST /api/commands : Create a new resource
            //Test# 3.1 : Condition = Valid Object Submitted for Creation : Result = Object count increments by 1

            //Arrange
            var command = new Command {
                HowTo       = "Do unit test",
                Platform    = "xUNit Platform",
                CommandLine = "dotnet test"
            };
            var oldCount = _dbContext.CommandItems.Count();
            //Act
            var result = _controller.PostCommandItem(command);

            //Assert
            Assert.Equal(oldCount + 1, _dbContext.CommandItems.Count());
        }