public void EditCourseExchangeMetalWhitHugeIncorrectValue() { MetalAccount testAccount = new MetalAccount(2, "Test2", 00.00, false, 10.00, "Uran", 100); const string expectedExceptionMessage = "Заданный аргумент находится вне диапазона допустимых значений.\r\nИмя параметра: Невозможно изменить курс обмена. Курс не может превышать 100000 ведь!"; var factException = Assert.Throws <ArgumentOutOfRangeException>(() => testAccount.EditCourseExchangeMetal(110000)); Assert.That(factException.Message, Is.EqualTo(expectedExceptionMessage)); }
public void EditCourseExchangeMetalOnClosedAccount() { MetalAccount testAccount = new MetalAccount(2, "Test2", 00.00, true, 10.00, "Uran", 100); string expectedExceptionMessage = $"Счет {testAccount.Id} закрыт, операция не может быть произведена."; var factException = Assert.Throws <InvalidOperationException>(() => testAccount.EditCourseExchangeMetal(50)); Assert.That(factException.Message, Is.EqualTo(expectedExceptionMessage)); }
public void EditCourseExchangeMetalWhithMaxValue() { MetalAccount testAccount = new MetalAccount(2, "Test2", 00.00, false, 10.00, "Uran", 100); testAccount.EditCourseExchangeMetal(10000.00); const double expectedCourseExchangeMeta = 10000.00; const double expectedSum = 100000; Assert.IsTrue(Math.Abs(testAccount.CourseExchangeMetal - expectedCourseExchangeMeta) <= 1e-7, $"Фактический курс обмена {testAccount.CourseExchangeMetal} отличается от ожидаемого {expectedCourseExchangeMeta}"); Assert.IsTrue(Math.Abs(testAccount.Sum - expectedSum) <= 1e-10, $"Фактическая сумма на счете {testAccount.Sum} отличается от ожидаемой {expectedSum}"); }