public void GivenUpdateFromFile_WhenBadArg_ThenThrow()
        {
            //Arrange
            var    dbControlMock   = Substitute.For <IDBControl>();
            var    fileControlMock = Substitute.For <IFileControl>();
            var    taxManager      = new TaxManagementClass(fileControlMock, dbControlMock);
            string arg             = "test";
            string expectedResult  = "ERROR: bad arguments!";

            //Act
            string result = taxManager.UpdateFromFile(arg);

            //Assert
            Assert.AreEqual(expectedResult, result);
        }
        public void GivenFindTax_WhenGoodParameters_ThenReturnTax()         //Fail - no DB, List empty
        {
            //Arrange
            var    dbControlMock             = Substitute.For <IDBControl>();
            var    fileControlMock           = Substitute.For <IFileControl>();
            var    taxManager                = new TaxManagementClass(fileControlMock, dbControlMock);
            string goodMunicipalityParameter = "Vilnius";
            string goodDateParameter         = "2019-01-03";
            string expectedResult            = "Tax: 0,2";

            //Act
            string result = taxManager.FindTax(goodMunicipalityParameter, goodDateParameter);

            //Assert
            Assert.AreEqual(expectedResult, result);
        }
        public void GivenFindTax_WhenNullMunicipality_ThenThrow()
        {
            //Arrange
            var    dbControlMock            = Substitute.For <IDBControl>();
            var    fileControlMock          = Substitute.For <IFileControl>();
            var    taxManager               = new TaxManagementClass(fileControlMock, dbControlMock);
            string badMunicipalityParameter = null;
            string goodDateParameter        = "2019-01-01";
            string expectedResult           = "ERROR: bad arguments!";

            //Act
            string result = taxManager.FindTax(badMunicipalityParameter, goodDateParameter);

            //Assert
            Assert.AreEqual(expectedResult, result);
        }
        public void GivenUpdateFromFile_WhenGoodFileGoodArg_ThenAddRecord()
        {
            //Arrange
            var    dbControlMock   = Substitute.For <IDBControl>();
            var    fileControlMock = Substitute.For <IFileControl>();
            var    taxManager      = new TaxManagementClass(fileControlMock, dbControlMock);
            string arg             = "update";
            string expectedResult  = "Taxes from file: " +
                                     "municipality " + "Vilnius" +
                                     "; tax " + "0,3" +
                                     "; start date " + "2019-05-30" +
                                     "; end date " + "-" +
                                     "; tax type " + "Daily";

            //Act
            string result = taxManager.UpdateFromFile(arg);

            //Assert
            Assert.AreEqual(expectedResult, result);
        }