public void ThrowInvalidUnitCreationCommandException_WhenTheCommandIsNotValid(string command)
        {
            var factory = new UnitsFactory();

            Assert.Throws <InvalidUnitCreationCommandException>
                (() => factory.GetUnit(command));
        }
Exemple #2
0
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidUnitTypeCommandIsPassed()
        {
            // Arrange
            var createUnit = new UnitsFactory();

            Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("create unit Procyno Gosho 1"));
        }
Exemple #3
0
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenCommandParameterIsInvalid(string command)
        {
            var unitsFactory = new UnitsFactory();

            Assert.That(() => unitsFactory.GetUnit(command),
                        Throws.InstanceOf <InvalidUnitCreationCommandException>());
        }
Exemple #4
0
        public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidIdPassed()
        {
            // Arrange
            var uf = new UnitsFactory();

            // Act and Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => uf.GetUnit("create unit Lacaille Pesho ID"));
        }
Exemple #5
0
        public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenStringDoesNotContainsValidType()
        {
            // Arrange
            var uf = new UnitsFactory();

            // Act and Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => uf.GetUnit("create unit INVALID_TYPE Pesho 2"));
        }
        public void ThrowInvalidUnitCreationCommandException_WhenThePassedCommandIsInvalid(string command)
        {
            // Arrange
            var factory = new UnitsFactory();

            // Act & Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => factory.GetUnit(command));
        }
Exemple #7
0
        public void ThrowInvalidUnitCreationCommandExceptionWhenPassedCommandIsNull()
        {
            //Arrange
            var sut = new UnitsFactory();

            //Act & Assert
            Assert.ThrowsException <InvalidUnitCreationCommandException>(() => sut.GetUnit(null));
        }
        public void ReturnCorrectUnitType_WhenValidCommandIsPassed(string command, Type type)
        {
            var factory = new UnitsFactory();

            var unit = factory.GetUnit(command);

            Assert.IsInstanceOf(type, unit);
        }
Exemple #9
0
        public void GetUnit_WhenTheCommandPassedIsNotInTheValidFormat_ShouldThrowInvalidUnitCreationCommandException(string invalidInput)
        {
            // Arrange
            var factory = new UnitsFactory();

            // Act &&  // Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => factory.GetUnit(invalidInput));
        }
Exemple #10
0
        public void GetUnit_WhenCommandIsValid_ShouldReturnNewProcyonUnit()
        {
            var unitFactory = new UnitsFactory();

            var unit = unitFactory.GetUnit("create unit Procyon Gosho 1");

            Assert.IsInstanceOf <Procyon>(unit);
        }
Exemple #11
0
        public void ThrowInvalidUnitCreationCommandExceptionWhenUnitTypeIsInvalid()
        {
            //Arrange
            var sut = new UnitsFactory();

            //Act & Assert
            Assert.ThrowsException <InvalidUnitCreationCommandException>(() => sut.GetUnit("create unit Invalid Pesho 1"));
        }
Exemple #12
0
        public void TestGetUnit_PassValidLacailleCommand_ShouldInitialiseCorrectly(string command)
        {
            var factory = new UnitsFactory();

            var proycon = factory.GetUnit(command);

            Assert.IsInstanceOf <Lacaille>(proycon);
        }
        public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidIdPassed()
        {
            // Arrange
            var uf = new UnitsFactory();

            // Act and Assert
            Assert.Throws<InvalidUnitCreationCommandException>(() => uf.GetUnit("create unit Lacaille Pesho ID"));
        }
Exemple #14
0
        public void GetUnit_WhenCommandIsValid_ShouldReturnNewLacailleUnit()
        {
            var unitFactory = new UnitsFactory();

            var unit = unitFactory.GetUnit("create unit Lacaille Tosho 3");

            Assert.IsInstanceOf <Lacaille>(unit);
        }
Exemple #15
0
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidUnitIdCommandIsPassed()
        {
            // Arrange
            var createUnit = new UnitsFactory();

            // Act & Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("create unit Procyon Gosho 165461854894651654986164894615"));
        }
        public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenStringDoesNotContainsValidType()
        {
            // Arrange
            var uf = new UnitsFactory();

            // Act and Assert
            Assert.Throws<InvalidUnitCreationCommandException>(()=> uf.GetUnit("create unit INVALID_TYPE Pesho 2"));
        }
Exemple #17
0
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidFormatCommandIsPassed()
        {
            // Arrange
            var createUnit = new UnitsFactory();

            // Act & Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("Procyon Gosho 1 create unit"));
        }
Exemple #18
0
        public void ThrowInvalidUnitCreationCommandExceptionWhenUnitIDIsNotANumber()
        {
            //Arrange
            var sut = new UnitsFactory();

            //Act & Assert
            Assert.ThrowsException <InvalidUnitCreationCommandException>(() => sut.GetUnit("create unit Lacaille Pesho NotANumber"));
        }
Exemple #19
0
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenNullCommandIsPassed()
        {
            // Arrange
            var createUnit = new UnitsFactory();

            // Act & Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit(null));
        }
Exemple #20
0
        public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateLacaillet()
        {
            var factory = new UnitsFactory();

            var Unit = factory.GetUnit("create unit Lacaille Tosho 3");

            Assert.IsInstanceOf <Lacaille>(Unit);
        }
Exemple #21
0
        public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateLuyten()
        {
            var factory = new UnitsFactory();

            var Unit = factory.GetUnit("create unit Luyten Pesho 2");

            Assert.IsInstanceOf <Luyten>(Unit);
        }
Exemple #22
0
        public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateProcyon()
        {
            var factory = new UnitsFactory();

            var Unit = factory.GetUnit("create unit Procyon Gosho 1");

            Assert.IsInstanceOf <Procyon>(Unit);
        }
Exemple #23
0
        //The following testcase doesn't throw an error, although command is invalid. Sadly we cannot edit the source code :(
        //[TestCase("Dreate unit Luyten Pesho 2")]
        public void GetUnit_WhenInvalidCommandIsPassed_ShouldThrowInvalidUnitCreationCommandException(string command)
        {
            //Arrange
            var factory = new UnitsFactory();

            //Act and assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => factory.GetUnit(command));
        }
Exemple #24
0
        public void GetUnit_WhenCommandIsValid_ShouldReturnNewLuytenUnit()
        {
            var unitFactory = new UnitsFactory();

            var unit = unitFactory.GetUnit("create unit Luyten Pesho 2");

            Assert.IsInstanceOf <Luyten>(unit);
        }
Exemple #25
0
        [TestCase("create unit Procyon Gosho one")] // test with passing invalid Id number
        public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenThePassedCommandIsNotInTheValidFormat(string command)
        {
            // Arrange
            string enteredCommand = command;
            var    unitFactory    = new UnitsFactory();

            // Act and Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => unitFactory.GetUnit(enteredCommand));
        }
Exemple #26
0
        public void ThrowException_WhenInvalidParameterCountIsPassed()
        {
            // Arrange
            string       command      = "create Luyten Tosho 3";
            UnitsFactory unitsFactory = new UnitsFactory();

            // Act && Assert
            Assert.Throws <InvalidUnitCreationCommandException>(() => unitsFactory.GetUnit(command));
        }
Exemple #27
0
        public void GetUnit_ShouldReturnANewLacailleUnit_WhenAValidMatchingCommandParatemerIsPassed()
        {
            var command      = "create unit Lacaille Gosho 1";
            var unitsFactory = new UnitsFactory();

            var actualUnit = unitsFactory.GetUnit(command);

            Assert.That(actualUnit, Is.Not.Null.And.InstanceOf <Lacaille>());
        }
Exemple #28
0
        public void GetUnit_ShourReturnANewProcyonUnit_WhenAValidMatchingCommandParameterIsPassed()
        {
            var command      = "create unit Procyon Gosho 1";
            var unitsFactory = new UnitsFactory();

            var actualUnit = unitsFactory.GetUnit(command);

            Assert.That(actualUnit, Is.Not.Null.And.InstanceOf <Procyon>());
        }
Exemple #29
0
        public void GetUnit_ShouldReturnLuyten_WhenValidCorrespondingCommandIsPassed()
        {
            var validCommand = "create unit Luyten Pesho 2";

            var factory = new UnitsFactory();

            var result = factory.GetUnit(validCommand);

            Assert.IsInstanceOf <Luyten>(result);
        }
Exemple #30
0
        public void GetUnit_ShouldReturnProcyon_WhenValidCorrespondingCommandIsPassed()
        {
            var validCommand = "create unit Procyon Gosho 1";

            var factory = new UnitsFactory();

            var result = factory.GetUnit(validCommand);

            Assert.IsInstanceOf <Procyon>(result);
        }
Exemple #31
0
        public void GetUnit_ShouldReturnLacaille_WhenValidCorrespondingCommandIsPassed()
        {
            var validCommand = "create unit Lacaille Tosho 3";

            var factory = new UnitsFactory();

            var result = factory.GetUnit(validCommand);

            Assert.IsInstanceOf <Lacaille>(result);
        }
Exemple #32
0
        public void GetUnit_WhenValidCommandIsPassed_ShouldReturnCorrespondingUnit(string command, Type expectedType)
        {
            //Arrange
            var factory = new UnitsFactory();
            //Act
            var unit = factory.GetUnit(command);

            //Assert
            Assert.IsInstanceOf(expectedType, unit);
        }
        public void UnitsFactoryGetUnit_ShouldInstantiateCorrectInstance_WhenValuePassedIsCorrect(string command, Type type)
        {
            // Arrange
            var uf = new UnitsFactory();

            // Act
            var unit = uf.GetUnit(command);

            // Assert
            Assert.IsInstanceOf(type, unit);
        }