Esempio n. 1
0
        public void SaveCallsCorrectStorageWhennotNull()
        {
            // Given

            var mockStorage = new Mock <IStorage>();

            var inputs = new QuoteInputs()
            {
                CustomerName     = "Michael Law",
                DeliveryDate     = new DateTime(2019, 6, 22),
                NumberOfYearsStr = "1",
                ArrangementFee   = 100.0M,
                SettlementFee    = 10.0M,
                VehiclePrice     = 12000.0M,
                Deposit          = 6000.0M
            };

            var sut = new CalculateQuote(mockStorage.Object);

            // When

            var outputs = sut.Calculate(inputs);

            sut.Save(outputs);

            // Then

            mockStorage.Verify(i => i.Get <List <Quote> >(Keys.Quotes), Times.Once);
            mockStorage.Verify(i => i.Set(Keys.Quotes, It.IsAny <List <Quote> >()), Times.Once);
        }
Esempio n. 2
0
        public void SaveCallsThrowsWhenInputsNull()
        {
            // Given

            var mockStorage = new Mock <IStorage>();

            var inputs = new QuoteInputs()
            {
                CustomerName     = "Michael Law",
                DeliveryDate     = new DateTime(2019, 6, 22),
                NumberOfYearsStr = "1",
                ArrangementFee   = 100.0M,
                SettlementFee    = 10.0M,
                VehiclePrice     = 12000.0M,
                Deposit          = 6000.0M
            };

            var sut = new CalculateQuote(mockStorage.Object);

            // When

            Assert.Throws <ArgumentNullException>(() => sut.Save(null));
        }