sovrin-rust-client-lib 0.1.0

sovrin-rust-client-lib
use services::sovrin::SovrinService;

struct SetDIDCommand<'a> {
    executor: &'a SetDIDCommandExecutor <'a>
}

impl <'a> SetDIDCommand <'a> {
    fn new(executor: &'a SetDIDCommandExecutor) -> SetDIDCommand <'a> {
        SetDIDCommand { executor: executor }
    }
}

struct SetDIDCommandExecutor <'a> {
    sovrin_service: &'a SovrinService,
    dummy: String
}

impl <'a> SetDIDCommandExecutor <'a> {
    fn new(sovrin_service: &SovrinService) -> SetDIDCommandExecutor {
        SetDIDCommandExecutor {
            sovrin_service: sovrin_service,
            dummy: "set_did_command_executor_dummy".to_string()
        }
    }

    fn new_command(&self) -> SetDIDCommand {
        SetDIDCommand::new(self)
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn command_creation_is_possible() {
        let sovrin_service = SovrinService::new();
        let executor = SetDIDCommandExecutor::new(&sovrin_service);
        let command = executor.new_command();

        assert_eq!("set_did_command_executor_dummy", command.executor.dummy, "Executor filled properly");
    }
}