public void ThrowInvalidUnitCreationCommandException_WhenTheCommandIsNotValid(string command) { var factory = new UnitsFactory(); Assert.Throws <InvalidUnitCreationCommandException> (() => factory.GetUnit(command)); }
public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidUnitTypeCommandIsPassed() { // Arrange var createUnit = new UnitsFactory(); Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("create unit Procyno Gosho 1")); }
public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenCommandParameterIsInvalid(string command) { var unitsFactory = new UnitsFactory(); Assert.That(() => unitsFactory.GetUnit(command), Throws.InstanceOf <InvalidUnitCreationCommandException>()); }
public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidIdPassed() { // Arrange var uf = new UnitsFactory(); // Act and Assert Assert.Throws <InvalidUnitCreationCommandException>(() => uf.GetUnit("create unit Lacaille Pesho ID")); }
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)); }
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); }
public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenNullCommandIsPassed() { // Arrange var createUnit = new UnitsFactory(); // Act & Assert Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit(null)); }
public void GetUnit_WhenCommandIsValid_ShouldReturnNewLuytenUnit() { var unitFactory = new UnitsFactory(); var unit = unitFactory.GetUnit("create unit Luyten Pesho 2"); Assert.IsInstanceOf <Luyten>(unit); }
public void ThrowInvalidUnitCreationCommandExceptionWhenUnitTypeIsInvalid() { //Arrange var sut = new UnitsFactory(); //Act & Assert Assert.ThrowsException <InvalidUnitCreationCommandException>(() => sut.GetUnit("create unit Invalid Pesho 1")); }
void Start() { var unitsFactory = new UnitsFactory(); unitsFactory.AddFactory(new MagFactory()); unitsFactory.AddFactory(new InfantryFactory()); List <IUnit> units2 = unitsFactory.ParseFile("file.json"); }
public void UnitsFactoryGetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidIdPassed() { // Arrange var uf = new UnitsFactory(); // Act and Assert Assert.Throws<InvalidUnitCreationCommandException>(() => uf.GetUnit("create unit Lacaille Pesho ID")); }
public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateProcyon() { var factory = new UnitsFactory(); var Unit = factory.GetUnit("create unit Procyon Gosho 1"); Assert.IsInstanceOf <Procyon>(Unit); }
public void TestGetUnit_PassValidLacailleCommand_ShouldInitialiseCorrectly(string command) { var factory = new UnitsFactory(); var proycon = factory.GetUnit(command); Assert.IsInstanceOf <Lacaille>(proycon); }
public void GetUnit_WhenCommandIsValid_ShouldReturnNewProcyonUnit() { var unitFactory = new UnitsFactory(); var unit = unitFactory.GetUnit("create unit Procyon Gosho 1"); Assert.IsInstanceOf <Procyon>(unit); }
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 ThrowInvalidUnitCreationCommandExceptionWhenUnitIDIsNotANumber() { //Arrange var sut = new UnitsFactory(); //Act & Assert Assert.ThrowsException <InvalidUnitCreationCommandException>(() => sut.GetUnit("create unit Lacaille Pesho NotANumber")); }
public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidUnitIdCommandIsPassed() { // Arrange var createUnit = new UnitsFactory(); // Act & Assert Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("create unit Procyon Gosho 165461854894651654986164894615")); }
public void GetUnit_ShouldThrowInvalidUnitCreationCommandException_WhenInvalidFormatCommandIsPassed() { // Arrange var createUnit = new UnitsFactory(); // Act & Assert Assert.Throws <InvalidUnitCreationCommandException>(() => createUnit.GetUnit("Procyon Gosho 1 create unit")); }
public void GetUnit_WhenTheCommandPassedIsNotInTheValidFormat_ShouldThrowInvalidUnitCreationCommandException(string invalidInput) { // Arrange var factory = new UnitsFactory(); // Act && // Assert Assert.Throws <InvalidUnitCreationCommandException>(() => factory.GetUnit(invalidInput)); }
public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateLacaillet() { var factory = new UnitsFactory(); var Unit = factory.GetUnit("create unit Lacaille Tosho 3"); Assert.IsInstanceOf <Lacaille>(Unit); }
public void GetUnit_WhenAValidCorrespondingCommandIsPassed_ShoudCreateLuyten() { var factory = new UnitsFactory(); var Unit = factory.GetUnit("create unit Luyten Pesho 2"); Assert.IsInstanceOf <Luyten>(Unit); }
//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)); }
public void GetUnit_WhenCommandIsValid_ShouldReturnNewLacailleUnit() { var unitFactory = new UnitsFactory(); var unit = unitFactory.GetUnit("create unit Lacaille Tosho 3"); Assert.IsInstanceOf <Lacaille>(unit); }
[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)); }
public void ThrowException_WhenInvalidParameterCountIsPassed() { // Arrange string command = "create Luyten Tosho 3"; UnitsFactory unitsFactory = new UnitsFactory(); // Act && Assert Assert.Throws <InvalidUnitCreationCommandException>(() => unitsFactory.GetUnit(command)); }
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>()); }
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>()); }
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); }
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); }
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); }