예제 #1
0
        public void InstrumentPart_Constructor_StringArgumentInstrumentNameIsWhiteSpace_ThrowsArgumentException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart("  ", 1);
        }
예제 #2
0
        public void InstrumentPart_Constructor_IntArgumentNumberOfCopiesLessThanZero_ThrowsArgumentException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart("Flute", -1);
        }
        public void TestInstrumentPartConstructor_ArgumentNumberOfCopiesIsLessThanZero_ThrowsArgumentException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), -1);
        }
예제 #4
0
        public void InstrumentPart_Constructor_StringArgumentInstrumentNameIsNull_ThrowsArgumentNullException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(null, 1);
        }
        public void TestInstrumentPartConstructor_ArgumentInstrumentIsNull_ThrowsArgumentNullException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(null, 5);
        }
        public void TestInstrumentPart_MethodsetNumberOfCopies_ArgumentNumberIsLessThanZero_ThrowsArgumentException()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), 5);

            //Act
            myInstrumentPart.setNumberOfCopies(-1);
        }
예제 #7
0
        public void InstrumentPart_Constructor_ClassFieldNumberOfCopiesCorrectlySet()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart("  Flute ", 1);

            //Assert
            Assert.AreEqual(1, myInstrumentPart.NumberOfCopies);
        }
예제 #8
0
        public void InstrumentPart_Constructor_ClassFieldInstrumentName_LowerCaseCorrectlySet()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart("  Flute ", 1);

            //Assert
            Assert.AreEqual("flute", myInstrumentPart.InstrumentName_LowerCase);
        }
        public void TestInstrumentPartConstructorSetsInstrumentApprovedCorrectly()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), 5);

            //Assert
            Assert.AreEqual(true, myInstrumentPart._Instrument.Approved);
        }
        public void TestInstrumentPartConstructorSetsInstrumentNameCorrectly()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), 5);

            //Assert
            Assert.AreEqual("trombone", myInstrumentPart._Instrument.InstrumentName);
        }
        public void TestInstrumentPartConstructorSetsNumberOfCopiesCorrectly()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), 5);

            //Assert
            Assert.AreEqual(5, myInstrumentPart.NumberOfCopies);
        }
        public void TestInstrumentPart_MethodSetNumberOfCopies()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            myInstrumentPart = new InstrumentPart(new Instrument("Trombone", true), 5);

            //Act
            myInstrumentPart.setNumberOfCopies(10);

            //Assert
            Assert.AreEqual(10, myInstrumentPart.NumberOfCopies);
        }
        public void TestInstrumentPartConstructorSetsInstrumentNumberOfTimesUsedCorrectly()
        {
            //Arrange
            InstrumentPart myInstrumentPart;

            //Act
            //Note, because false is passed into the constructor of the Instrument as the "createdByAdministrator"
            //parameter, we know this new Instrument was created by a user and thus is actually being used, which
            //is why numberOfTimesUsed is initially set to one in this case.
            myInstrumentPart = new InstrumentPart(new Instrument(instrumentName: "Trombone", createdByAdministrator: false), 5);

            //Assert
            Assert.AreEqual(1, myInstrumentPart._Instrument.NumberOfTimesUsed);
        }