Example #1
0
        public void Get_By_Id_Should_Throw_An_Exception_If_Id_Is_Not_Existing()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            // Act
            chainblock.Add(this.firstTransaction);

            // Assert
            Assert.Throws <InvalidOperationException>(
                () => chainblock.GetById(1110), // Act
                "This id is existing.");
        }
Example #2
0
        public void Get_By_Id_Should_Throw_An_Exception_If_Id_Is_Under_Zero()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            // Act
            chainblock.Add(this.firstTransaction);

            // Assert
            Assert.Throws <ArgumentOutOfRangeException>(
                () => chainblock.GetById(-100), // Act
                "This id is not zero.");
        }
Example #3
0
        public void Get_By_Id_Should_Return_Transaction_Correctly()
        {
            // Arrange
            var chainblock = new Models.Chainblock();

            // Act
            chainblock.Add(this.firstTransaction);

            var transaction = chainblock.GetById(10);

            // Assert
            Assert.That(transaction, Is.Not.Null);
            Assert.That(transaction.Id, Is.EqualTo(10));
            Assert.That(transaction.From, Is.EqualTo("Ivan"));
            Assert.That(transaction.To, Is.EqualTo("Samuil"));
            Assert.That(transaction.Amount, Is.EqualTo(50));
            Assert.That(transaction.Status, Is.EqualTo(TransactionStatus.Successfull));
        }