public void Can_Get_Latest_Id()
        {
            var cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);
            int?result           = cryptoCurrencyDb.GetLatestId();

            Assert.NotNull(result);
        }
        public void Can_Setup_CryptoCurrencyDb_And_CreateDatabase_With_Records()
        {
            var cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);
            var isSetup          = cryptoCurrencyDb.Setup();

            Assert.True(isSetup);
        }
        public void ThrowArgumentException_When_CryptoCurrencyName_Is_Wrong()
        {
            string currencyName = "Bitcoin";

            var cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);

            Assert.Throws <ArgumentException>(() => cryptoCurrencyDb.GetCryptoCurrency(currencyName, true));
        }
        public void Can_Get_CryptoCurrencyName_Bitcoin()
        {
            string currencyName     = "Bitcoin";
            var    cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);

            var result = cryptoCurrencyDb.GetCryptoCurrency(currencyName, true);

            Assert.Equal(currencyName, result.CurrencyName);
        }
        public void Can_Update_UnitInDollar_Bitcoin()
        {
            string currencyName = "Bitcoin";

            var cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);


            cryptoCurrencyDb.UpdateUnit(currencyName, 100);

            CryptoCurrencyDbModel result = cryptoCurrencyDb.GetCryptoCurrency(currencyName, true);

            Assert.Equal(100, result.UnitPrice);
        }
Example #6
0
 public UnitTestConverter()
 {
     //Arrange currency db
     _cryptoCurrencyDb = new CryptoCurrencyDb(DatabaseConnectionString);
 }
Example #7
0
 public Converter(CryptoCurrencyDb cryptoCurrencyDb)
 {
     _cryptoCurrencyDb = cryptoCurrencyDb;
     _validation       = new Validation(cryptoCurrencyDb);
 }
 public Validation(CryptoCurrencyDb cryptoCurrencyDb)
 {
     _cryptoCurrencyDb = cryptoCurrencyDb;
 }