Esempio n. 1
0
        public void DeleteCommandItem_Decriment()
        {
            // prep
            var commands = CreateCommands(1);
            var cmdId    = commands[0].Id;
            var objCount = dbContext.CommandItems.Count();

            // call
            controller.DeleteCommandItem(cmdId);

            // verify
            Assert.That(objCount - 1 == dbContext.CommandItems.Count());
        }
Esempio n. 2
0
        public void DeleteCommandItem_ObjectsDecrement_WhenValidObjectID()
        {
            //Arrange
            var command = new Command {
                HowTo = "Do Somethting", Platform = "Some Platform", CommandLine = "Some Command"
            };

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

            var cmdId    = command.Id;
            var objCount = dbContext.commandItems.Count();

            //Act
            Controller.DeleteCommandItem(cmdId);

            //Assert
            Assert.Equal(objCount - 1, dbContext.commandItems.Count());
        }
        public void DeleteCommandItemObjectsDecrementWhenValidObjectID()
        {
            var command = new Command
            {
                HowTo       = "Do Somethting",
                Platform    = "Some Platform",
                CommandLine = "Some Command"
            };

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

            var commandId = command.Id;
            var oldCount  = dbContext.CommandItems.Count();

            controller.DeleteCommandItem(commandId);

            Assert.Equal(oldCount - 1, dbContext.CommandItems.Count());
        }
        public void DeleteCommandItem_ObjectCountDecrementedBy1_WhenUsingValidItemId( )
        {
            // Arrange
            var command = new Command
            {
                HowTo       = "Do Something",
                Platform    = "Test 5.1",
                CommandLine = "Some CommandLine"
            };

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

            var cmdId    = command.Id;
            var objCount = _dbContext.CommandItems.Count( );

            // Act
            _controller.DeleteCommandItem(cmdId);

            //Assert
            Assert.Equal(objCount - 1, _dbContext.CommandItems.Count( ));
        }
Esempio n. 5
0
        public void DeleteCommandItem_ObjectsDecrement_WhenValidObjectID()
        {
            //Action 5 Test : DELETE /api/commands/{Id} : Delete a single resource, (by Id)
            //Test# 5.1 : Condition = Valid Object Id Submitted for Delete : Result = Object Count Decrements by 1

            //Arrange
            var _command = new Command {
                HowTo       = "Do unit test",
                Platform    = "xUNit Platform",
                CommandLine = "dotnet test"
            };

            _dbContext.CommandItems.Add(_command);
            _dbContext.SaveChanges();
            int cmdId    = _command.Id;
            int objCount = _dbContext.CommandItems.Count();

            //Act
            _controller.DeleteCommandItem(cmdId);
            //Assert
            Assert.Equal(objCount - 1, _dbContext.CommandItems.Count());
        }
Esempio n. 6
0
        public void DeleteCommandItem_DecrementBy1_WithValidInput()
        {
            // Arrange
            var command = new Command
            {
                HowTo       = "Do something",
                Platform    = "Some Platform",
                CommandLine = "Some Command"
            };

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

            var cmdId    = command.Id;
            var oldCount = dbContext.CommandItems.Count();

            // Act
            controller.DeleteCommandItem(cmdId);
            var count = dbContext.CommandItems.Count();

            // Assert
            Assert.Equal(oldCount, count + 1);
        }