Belletti/Belletti/Test/TestGun.cs
/// <summary>
/// tests Gun types, initially created from factory
/// </summary>
tests Gun types, initially created from factory
tests Gun types initially created from factory
[Fact]
		public void gunTypesTest()
		{
			Assert.Equal(10, beretta92.GetMaxAmmo());
			Assert.Equal(7, magmaGun.GetNAmmo());
			for (int i = 0; i < 80; i++)
			{
				machineGun.Shoot();
				Assert.True(machineGun.GetNAmmo() > 0);
			}
			try
			{
				for (int i = 1; i <= beretta92.GetMaxAmmo(); i++)
				{
					beretta92.Shoot();
					Assert.Equal(beretta92.GetMaxAmmo() - i, beretta92.GetNAmmo());
				}
			}
			catch (ArgumentException exception) {
				Console.WriteLine(exception.Message);
			}
			try
			{
				for (int i = 1; i <= magmaGun.GetMaxAmmo(); i++)
				{
					magmaGun.Shoot();
					Assert.Equal(magmaGun.GetMaxAmmo() - i, magmaGun.GetNAmmo());
				}
			}
			catch (ArgumentException exception){
				Console.WriteLine(exception.Message);
			}
			Assert.False(beretta92.IsSameTypeAs(machineGun));
			Assert.False(beretta92.IsSameTypeAs(magmaGun));
			Assert.False(magmaGun.IsSameTypeAs(machineGun));
		}
[ Fact ] public void gunTypesTest ( ) { Assert . Equal ( 10 , beretta92 . GetMaxAmmo ( ) ) ; Assert . Equal ( 7 , magmaGun . GetNAmmo ( ) ) ; for ( int i = 0 ; i < 80 ; i ++ ) { machineGun . Shoot ( ) ; Assert . True ( machineGun . GetNAmmo ( ) > 0 ) ; } try { for ( int i = 1 ; i <= beretta92 . GetMaxAmmo ( ) ; i ++ ) { beretta92 . Shoot ( ) ; Assert . Equal ( beretta92 . GetMaxAmmo ( ) - i , beretta92 . GetNAmmo ( ) ) ; } } catch ( ArgumentException exception ) { Console . WriteLine ( exception . Message ) ; } try { for ( int i = 1 ; i <= magmaGun . GetMaxAmmo ( ) ; i ++ ) { magmaGun . Shoot ( ) ; Assert . Equal ( magmaGun . GetMaxAmmo ( ) - i , magmaGun . GetNAmmo ( ) ) ; } } catch ( ArgumentException exception ) { Console . WriteLine ( exception . Message ) ; } Assert . False ( beretta92 . IsSameTypeAs ( machineGun ) ) ; Assert . False ( beretta92 . IsSameTypeAs ( magmaGun ) ) ; Assert . False ( magmaGun . IsSameTypeAs ( machineGun ) ) ; }
tests Gun types, initially created from factory
tests Gun types initially created from factory