public SetupAndCleanUpTest(ITestOutputHelper helper)
        {
            _testOutput = helper;

            _testOutput.WriteLine("Creating sut");
            _sut = new MemoryCalculator();
        }
        public void ShouldSubtractTwoNumbers(int first, int second, int expected)
        {
            var sut = new MemoryCalculator();
            sut.Subtract(first);
            sut.Subtract(second);

            Assert.Equal(expected, sut.CurrentValue);
        }
Example #3
0
        public void ShouldSubtractTwoNegativeNumbers(int firstNum, int secondNum, int expectedNum)
        {
            var sut = new MemoryCalculator();

            sut.Subtract(firstNum);
            sut.Subtract(secondNum);
            Assert.That(sut.CurrentValue, Is.EqualTo(expectedNum));
        }
Example #4
0
 /// <summary>
 /// Instantiate cache
 /// </summary>
 /// <param name="capacity">The buffers capacity</param>
 /// <param name="keyEquality">How a cache lookup is performed</param>
 public GCache(long capacity, IEqualityComparer <TKey> keyEquality)
 {
     _cache           = new ConcurrentDictionary <TKey, CacheEntry>(keyEquality);
     memoryCalculator = new MemoryCalculator();
     this.isDisposed  = false;
     this.buffer      = capacity;
     Events           = new EventAggregator <TKey, TCached>();
 }
Example #5
0
        public void ShouldSubtractPositiveNumbers()
        {
            var sut = new MemoryCalculator();

            sut.Subtract(5);

            Assert.Equal(-5, sut.CurrentValue);
        }
Example #6
0
        public void ShouldSubtractTwoNegativeNumbers_DataDriven(int fNum, int sNum, int exp)
        {
            sut = new MemoryCalculator();
            sut.Subtract(fNum);
            sut.Subtract(sNum);

            Assert.That(sut.CurrentValue, Is.EqualTo(exp));
        }
        public void ShouldAddAndDivide(
            [Values(10, 20, 30)] int numToAdd,
            [Values(2, 1, 10)]    int numToDivideBy)
        {
            var sut = new MemoryCalculator();

            sut.Add(numToAdd);
            sut.Divide(numToDivideBy);
        }
Example #8
0
        public void ShouldAddPositiveNumbers()
        {
            var sut = new MemoryCalculator();

            sut.Add(10);
            sut.Add(5);

            Assert.Equal(15, sut.CurrentValue);
        }
        public void ShouldSubtractTwoNegativeNumbers()
        {
            var sut = new MemoryCalculator();

            sut.Subtract(-5);
            sut.Subtract(-10);

            Assert.That(sut.CurrentValue, Is.EqualTo(15));
        }
Example #10
0
        public void ShouldSubtractTwoNumbers(int firstNumber, int secondNumber, int expectedResult)
        {
            var sut = new MemoryCalculator();

            sut.Subtract(firstNumber);
            sut.Subtract(secondNumber);

            Assert.Equal(expectedResult, sut.CurrentValue);
        }
        public void ShouldDividePositiveNumbers()
        {
            var sut = new MemoryCalculator();

            sut.Add(10);
            sut.Divide(2);

            Assert.Equal(5, sut.CurrentValue);
        }
Example #12
0
        public void ShouldAddAndDivide(
            int numToAdd,
            int numToDivideBy)
        {
            var sut = new MemoryCalculator();

            sut.Add(numToAdd);

            sut.Divide(numToDivideBy);
        }
        public void ShouldSubtract(int first, int second, int expected)
        {
            _outputHelper.WriteLine("ShouldSubtract started");
            MemoryCalculator calc = new MemoryCalculator();
            calc.Clear();
            calc.Subtract(first);
            calc.Subtract(second);

            Assert.Equal(expected, calc.CurrentValue);
            _outputHelper.WriteLine("ShouldSubtract finished");
        }
        public XUnit(ITestOutputHelper testOutput, MemoryCalculatorFixture calculatorFixture)
        {
            //Arrange
            calc                = new Calculator();
            stringWorker        = new StringWorker();
            collectionGenerator = new CollectionGenerator();
            randomGenerator     = new RandomGenerator();
            carFactory          = new CarFactory();
            this.testOutput     = testOutput;
            memoryCalculator    = new MemoryCalculator();

            memoryCalculatorFixture = calculatorFixture;
            memoryCalculatorFixture.MemoryCalculator.ClearData();

            this.testOutput.WriteLine("Hello from constructor!");
        }
 public MemoryCalculatorFixture()
 {
     Sut = new MemoryCalculator();
 }
Example #16
0
 public void AfterEachTest()
 {
     Trace.WriteLine($"BeforeAndAfterTest::After {TestContext.CurrentContext.Test.Name}");
     _sut = null;
 }
Example #17
0
 public void BeforeEachTest()
 {
     Trace.WriteLine($"BeforeAndAfterTest::Before {TestContext.CurrentContext.Test.Name}");
     _sut = new MemoryCalculator();
 }
Example #18
0
 public void AfterFixture()
 {
     Trace.WriteLine($"NormalBeforeAndAfterTest::After {nameof(MemoryCalculatorTests)}");
     _sut = null;
 }
Example #19
0
 public void BeforeFixture()
 {
     Trace.WriteLine($"NormalBeforeAndAfterTest::Before {nameof(MemoryCalculatorTests)}");
     _sut = new MemoryCalculator();
 }
Example #20
0
        public void AfterEachTest()
        {
            Console.WriteLine("After {0}", TestContext.CurrentContext.Test.Name);

            sut = null;
        }
Example #21
0
        public void BeforeEachTest()
        {
            Console.WriteLine("Before {0}", TestContext.CurrentContext.Test.Name);

            sut = new MemoryCalculator();
        }
Example #22
0
 public void BeforeAllTests()
 {
     Console.WriteLine($"Before {TestContext.CurrentContext.Test.Name} ");
     _sut = new MemoryCalculator();
 }
 public MemoryCalculatorTest(ITestOutputHelper helper)
 {
     this._helper = helper;
     _helper.WriteLine("Creating memory calculator");
     _sut = new MemoryCalculator();
 }
Example #24
0
 public void AfterEachTest()
 {
     Console.WriteLine($"After {TestContext.CurrentContext.Test.Name}");
     _sut = null;
 }