コード例 #1
0
        public void PaysFees_CallsVehicleFees_WhenCalled()
        {
            // Arrange
            var fees = Substitute.For <IVehicleFees>();
            var sut  = new TestBaseVehilce(fees,
                                           DefaultId,
                                           DefaultWeightInKilogram);

            // Act
            sut.PaysFee();

            // Assert
            fees.Received().FeeIsPaid();
        }
コード例 #2
0
        public void ContainsFee_CallsVehicleFees_WhenCalled()
        {
            // Arrange
            var fee  = Substitute.For <IFee>();
            var fees = Substitute.For <IVehicleFees>();
            var sut  = new TestBaseVehilce(fees,
                                           DefaultId,
                                           DefaultWeightInKilogram);

            // Act
            sut.ContainsFee(fee);

            // Assert
            fees.Received().ContainsFee(fee);
        }
コード例 #3
0
        public void Constructor_SetsWeightInKilogram_WhenCalled()
        {
            // Arrange
            var fees = Substitute.For <IVehicleFees>();
            var sut  = new TestBaseVehilce(fees,
                                           DefaultId,
                                           DefaultWeightInKilogram);

            // Act
            int actual = sut.WeightInKilogram;

            // Assert
            Assert.AreEqual(DefaultWeightInKilogram,
                            actual);
        }
コード例 #4
0
        public void ToString_ReturnsString_WhenCalled()
        {
            // Arrange
            var fees = Substitute.For <IVehicleFees>();
            var sut  = new TestBaseVehilce(fees,
                                           DefaultId,
                                           DefaultWeightInKilogram);

            // Act
            string actual = sut.ToString();

            // Assert
            Assert.AreEqual("Id: 1 ShortDescription:  Fees: 0 IsFeePaid: False",
                            actual);
        }
コード例 #5
0
        public void ShortDescription_ReturnsString_WhenCalled()
        {
            // Arrange
            var fees = Substitute.For <IVehicleFees>();
            var sut  = new TestBaseVehilce(fees,
                                           DefaultId,
                                           DefaultWeightInKilogram);

            // Act
            string actual = sut.ShortDescription;

            // Assert
            Assert.AreEqual(string.Empty,
                            actual);
        }
コード例 #6
0
        public void IsFeePaid_CallsVehicleFees_WhenCalled()
        {
            // Arrange
            var fees = Substitute.For <IVehicleFees>();

            fees.IsFeePaid.Returns(true);
            var sut = new TestBaseVehilce(fees,
                                          DefaultId,
                                          DefaultWeightInKilogram);

            // Act
            bool actual = sut.IsFeePaid;

            // Assert
            Assert.True(actual);
        }
コード例 #7
0
        public void Fees_CallsVehicleFees_WhenCalled()
        {
            // Arrange
            var expected = new IFee[0];
            var fees     = Substitute.For <IVehicleFees>();

            fees.Fees.Returns(expected);
            var sut = new TestBaseVehilce(fees,
                                          DefaultId,
                                          DefaultWeightInKilogram);

            // Act
            IEnumerable <IFee> actual = sut.Fees;

            // Assert
            Assert.AreEqual(expected,
                            actual);
        }