-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
José Antonio Córdoba Gómez
committed
Dec 11, 2020
1 parent
4abfc55
commit e9c1800
Showing
2 changed files
with
111 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
mod test_bankfund_galvanic{ | ||
use galvanic_assert::*; | ||
use galvanic_assert::matchers::*; | ||
|
||
use chrono::{NaiveDate, NaiveDateTime}; | ||
use crate::bankfund::model::bankfund::*; | ||
|
||
|
||
#[test] | ||
/// Test if constructor is correct | ||
fn test_new_fund(){ | ||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(&bf, is_variant!(Fund)); | ||
} | ||
|
||
#[test] | ||
/// Test if ID assignment is correct (inmutable getter - constructor) | ||
fn test_get_id(){ | ||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(bf.get_id(), eq(String::from("507f1f77bcf86cd799439011"))); | ||
} | ||
|
||
|
||
#[test] | ||
/// Test if card_number assignment is correct (inmutable getter - constructor) | ||
fn test_get_amount(){ | ||
|
||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(&bf.get_amount().clone(), eq(534.4)); | ||
} | ||
|
||
|
||
#[test] | ||
/// Test if date assignment is correct (inmutable getter - constructor) | ||
fn test_get_start_date(){ | ||
|
||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(&bf.get_start_date().clone(), is(eq(NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0)))); | ||
} | ||
|
||
|
||
#[test] | ||
/// Test if date assignment is correct (inmutable getter - constructor) | ||
fn test_get_finish_date(){ | ||
|
||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(&bf.get_finish_date().clone(), is(eq(NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0)))); | ||
} | ||
|
||
|
||
#[test] | ||
/// Test if status assignment is correct (inmutable getter - constructor) | ||
fn test_get_status(){ | ||
|
||
let id : String = String::from("507f1f77bcf86cd799439011"); | ||
let amount : f64 = 534.4; | ||
let date_start : NaiveDateTime = NaiveDate::from_ymd(2025, 7, 8).and_hms(22, 18, 0); | ||
let date_finish : NaiveDateTime = NaiveDate::from_ymd(2022, 7, 8).and_hms(22, 18, 0); | ||
let status : bool = true; | ||
|
||
let bf : Fund = Fund::new(id, amount,date_start,date_finish,status); | ||
|
||
assert_that!(&bf.is_active().clone(), is(eq(true))); | ||
} | ||
|
||
|
||
|
||
} |