49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using ShoeStore.Logic;
|
|
|
|
namespace ShoeStore.Test
|
|
{
|
|
[TestClass]
|
|
public sealed class ProductCalculatorTest
|
|
{
|
|
[TestMethod]
|
|
public void CalculateDiscountPrice_NoOrderslnPreviousMonth_ReturnsPriceWithDiscount()
|
|
{
|
|
decimal price = 2000m;
|
|
List<DateTime> orderDates = new List<DateTime>();
|
|
DateTime calculationDate = new DateTime(2027,6,15);
|
|
|
|
decimal result = ProductCalculator.CalculateDiscountedPrice(price, orderDates, calculationDate);
|
|
|
|
Assert.AreEqual(1500m, result);
|
|
}
|
|
[TestMethod]
|
|
public void CalculateDiscountPrice_OrederlnPreviousMonth_ReturnPriceWinthoutDiscount()
|
|
{
|
|
decimal price = 2000m;
|
|
List<DateTime> orderDates = new List<DateTime> {new DateTime(2027,5,10)};
|
|
DateTime calculationDate = new DateTime(2027,5,15);
|
|
|
|
decimal result = ProductCalculator.CalculateDiscountedPrice(price, orderDates, calculationDate);
|
|
|
|
Assert.AreEqual(1500m,result);
|
|
}
|
|
[TestMethod]
|
|
public void GetQuantityLabel_FivePairs_ReturnsFew()
|
|
{
|
|
string result = ProductCalculator.GetQuantityLabel(5);
|
|
|
|
Assert.AreEqual("мало", result);
|
|
}
|
|
[TestMethod]
|
|
public void GetQuantityLabel_SixPairs_ReturnsMany()
|
|
{
|
|
string result = ProductCalculator.GetQuantityLabel(6);
|
|
|
|
Assert.AreEqual("много", result);
|
|
}
|
|
}
|
|
}
|