Example #1
0
        public void Constructor_ShouldCorrectlySetOperation()
        {
            //Arrange
            var installerMock = new Mock <IInstaller <IPackage> >();
            var packageMock   = new Mock <IPackage>();

            var sut = new MockInstallCommand(installerMock.Object, packageMock.Object);

            //Act & Asser
            Assert.AreEqual(InstallerOperation.Install, installerMock.Object.Operation);
        }
Example #2
0
        public void Constructor_ShouldCorrectlySetPackaeg()
        {
            //Arrange
            var installerMock = new Mock <IInstaller <IPackage> >();
            var packageMock   = new Mock <IPackage>();

            var sut = new MockInstallCommand(installerMock.Object, packageMock.Object);

            //Act & Asser
            Assert.AreEqual(packageMock.Object, sut.MyPackage);
        }
        public void BeCorrectValuePackage()
        {
            // Arrange
            var installer = new Mock <IInstaller <IPackage> >();
            var package   = new Mock <IPackage>();

            // Act
            MockInstallCommand command = new MockInstallCommand(installer.Object, package.Object);

            // Assert
            Assert.AreEqual(package.Object, command.Package);
        }
Example #4
0
        public void SetRightValueForOperation()
        {
            // Arrange
            var installer = new Mock <IInstaller <IPackage> >();
            var package   = new Mock <IPackage>();
            var expected  = InstallerOperation.Install;

            // Act
            MockInstallCommand command = new MockInstallCommand(installer.Object, package.Object);

            // Assert
            Assert.AreEqual(expected, command.Installer.Operation);
        }
        public void SetTheAppropriateTypes()
        {
            // Arrange
            var installer = new Mock <IInstaller <IPackage> >();
            var package   = new Mock <IPackage>();

            // Act
            MockInstallCommand command = new MockInstallCommand(installer.Object, package.Object);

            // Assert
            Assert.AreEqual(installer.Object.GetType(), command.Installer.GetType());
            Assert.AreEqual(package.Object.GetType(), command.Package.GetType());
        }
Example #6
0
        public void Execute_ShouldCallOperationFromInstaller()
        {
            //Arrange
            var installerMock = new Mock <IInstaller <IPackage> >();
            var packageMock   = new Mock <IPackage>();

            var sut = new MockInstallCommand(installerMock.Object, packageMock.Object);

            //Act
            sut.Execute();

            //Assert
            installerMock.Verify(x => x.PerformOperation(packageMock.Object), Times.Once);
        }