예제 #1
0
        public void When_WriteIsCalled_Should_WriteToIWriter()
        {
            // arrange
            var writer     = Substitute.For <IWriter>();
            var legacyCode = new LegacyCode(writer, YetAnotherHorribleSingleton.Instance.IsRestaurantOpen);

            // act
            legacyCode.Write();

            // arrange
            writer.Received(1).Write();
        }
예제 #2
0
        public void BUG_When_CustomerIsNullIsOk_Should_ReturnFalse()
        {
            // arrange
            var writer     = Substitute.For <IWriter>();
            var legacyCode = new LegacyCode(writer, true);

            // act
            var isCustomerOk = legacyCode.IsCustomerOk(null);

            // arrange
            isCustomerOk.Should()
            .BeFalse();
        }
예제 #3
0
        public void When_CustomerIsOver60IsOk_Should_ReturnTrue()
        {
            // arrange
            var customer = new Customer {
                Age = 61
            };
            var writer     = Substitute.For <IWriter>();
            var legacyCode = new LegacyCode(writer, true);

            // act
            var isCustomerOk = legacyCode.IsCustomerOk(customer);

            // arrange
            isCustomerOk.Should()
            .BeTrue();
        }