Beispiel #1
0
        protected virtual void OnSetPath(object sender, EventArgs e)
        {
            string path = _view.GetPath();

            if (!File.Exists(path))
            {
                throw new ArgumentException(MessagesResources.ErrorFileNotFound);
            }

            _countMethod = GetCountMethod(path);
        }
        public void Count(GenerationLackyTicketsMethod method, byte quantityDigits, int expected)
        {
            // Arrange
            LuckyTicketsGenerator lackyGenerator = LuckyTicketsGenerator.Create(method, quantityDigits);

            // Act
            int real = lackyGenerator.Count();

            // Assert
            Assert.AreEqual(real, expected);
        }
        public static LuckyTicketsGenerator Create(GenerationLackyTicketsMethod method, byte quantityDigits)
        {
            switch (method)
            {
            case GenerationLackyTicketsMethod.Moskow:
                return(new LuckyTicketsGeneratorMoskow(quantityDigits));

            case GenerationLackyTicketsMethod.Piter:
                return(new LuckyTicketsGeneratorPiter(quantityDigits));

            default:
                throw new ArgumentException(MessagesResources.ErrorInvalidWorkMode);
            }
        }