示例#1
0
        public void ThrowArgumentException_WhenInvokedWithEmptyParametersCollection()
        {
            // Arrange
            var sportscardFactoryMock = new Mock <ISportscardFactory>();
            var sportshallServiceMock = new Mock <ISportshallService>();

            var sportshallName  = "Topfit";
            var expectedMessage = $"Sportshall \"{sportshallName}\" was deleted from database.";

            var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object);
            var parameters = new List <string>();

            //Act && Assert
            Assert.ThrowsException <ArgumentException>(() => deleteSportshallCommand.Execute(parameters));
        }
示例#2
0
        public void CallSportshallDeleteMethodOnce_WhenInvokedWithValidParameters()
        {
            // Arrange
            var sportscardFactoryMock = new Mock <ISportscardFactory>();
            var sportshallServiceMock = new Mock <ISportshallService>();

            var sportshallName = "Topfit";

            var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object);
            var parameters = new List <string>()
            {
                sportshallName
            };

            //Act
            deleteSportshallCommand.Execute(parameters);

            //Assert
            sportshallServiceMock.Verify(x => x.DeleteSportshall(sportshallName), Times.Once);
        }
示例#3
0
        public void ReturnSuccessMessage_WhenInvokedWithValidParameters()
        {
            // Arrange
            var sportscardFactoryMock = new Mock <ISportscardFactory>();
            var sportshallServiceMock = new Mock <ISportshallService>();

            var sportshallName  = "Topfit";
            var expectedMessage = $"Sportshall \"{sportshallName}\" was deleted from database.";

            var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object);
            var parameters = new List <string>()
            {
                sportshallName
            };

            //Act
            var actualMessage = deleteSportshallCommand.Execute(parameters);

            //Assert
            Assert.AreEqual(expectedMessage, actualMessage);
        }