Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Ticket13;
- namespace AbonentPaymentTest
- {
- [TestClass]
- public class UnitTest1
- {
- #region EconomTest
- [TestMethod]
- public void TestEconomSubscriptionNotPensioner() // Эконом + подписка
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Эконом;
- bool subscription = true;
- bool pensioner = false;
- int expectedPayment = 400; // 300 (subscription) + 100 (Econom) = 400
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestEconomSubscriptionPensioner() // Эконом + подписка + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Эконом;
- bool subscription = true;
- bool pensioner = true;
- int expectedPayment = 360; // 300 (subscription) + 100 (Econom) = 400, 400 * 0.9 = 360
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestEconomNoSubscriptionNotPensioner() // Эконом
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Эконом;
- bool subscription = false;
- bool pensioner = false;
- int expectedPayment = 100; // 0 + 100 (Econom) = 100
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestEconomNoSubscriptionPensioner() // Эконом + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Эконом;
- bool subscription = false;
- bool pensioner = true;
- int expectedPayment = 90; // 0 + 100 (Econom) = 100, 100 * 0.9 = 90
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- #endregion
- #region MiniTest
- [TestMethod]
- public void TestMiniSubscriptionPensioner() // мини + подписка + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Мини;
- bool subscription = true;
- bool pensioner = true;
- int expectedPayment = 90; // 300 (subscription) - 200 (Mini) = 100, 100 * 0.9 = 90
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestMiniNoSubscriptionPensioner() // мини + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Мини;
- bool subscription = false;
- bool pensioner = true;
- int expectedPayment = 0; // 0 (subscription) - 200 (Mini) = 0, 0 * 0.9 = 0
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestMiniSubscriptionNotPensioner() // мини + подписка
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Мини;
- bool subscription = true;
- bool pensioner = false;
- int expectedPayment = 100; // 300 (subscription) - 200 (Mini) = 100
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestMiniNoSubscriptionNotPensioner() // мини
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Мини;
- bool subscription = false;
- bool pensioner = false;
- int expectedPayment = 0; // 0 (subscription) - 200 (Mini) = 0
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- #endregion
- #region UniversalTest
- [TestMethod]
- public void TestUniversalSubscriptionPensioner() // Универсал + подписка + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Универсал;
- bool subscription = true;
- bool pensioner = true;
- int expectedPayment = 720; // 300 (subscription) + 500 (Universal) = 800, 800 * 0.9 = 720
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestUniversalSubscriptionNotPensioner() // Универсал + подписка
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Универсал;
- bool subscription = true;
- bool pensioner = false;
- int expectedPayment = 800; // 300 (subscription) + 500 (Universal) = 800
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestUniversalNoSubscriptionPensioner() // Универсал + пенсионер
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Универсал;
- bool subscription = false;
- bool pensioner = true;
- int expectedPayment = 450; // 0 + 500 (Universal) = 500, 500 * 0.9 = 450
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- [TestMethod]
- public void TestUniversalNoSubscriptionNotPensioner() // Универсал
- {
- Teleradio.TVPack selectedPack = Teleradio.TVPack.Универсал;
- bool subscription = false;
- bool pensioner = false;
- int expectedPayment = 500; // 0 + 500 (Universal) = 500
- int actualPayment = Teleradio.AbonentPayment(selectedPack, subscription, pensioner);
- Assert.AreEqual(expectedPayment, actualPayment);
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement