using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using WpfApp1; namespace UnitTestProject1 { [TestClass] public class UnitTest1 { private MainWindow mainWindow; [TestInitialize] public void Setup() { mainWindow = new MainWindow(); } [TestMethod] public void TestInputIsValid_WithValidNumber_ReturnsTrue() { string validInput = "1234"; bool result = mainWindow.IsInputValid(validInput); Assert.IsTrue(result); } //проверка на пустое значение [TestMethod] public void TestInputIsValid_WithEmptyInput_ReturnsFalse() { string emptyInput = ""; bool result = mainWindow.IsInputValid(emptyInput); Assert.IsFalse(result); } //проверка на ввод букв [TestMethod] public void TestInputIsValid_WithNonNumericInput_ReturnsFalse() { string nonNumericInput = "abc"; bool result = mainWindow.IsInputValid(nonNumericInput); Assert.IsFalse(result); } } }