Android Open Source - onedrive-picker-android Client Tests






From Project

Back to project page onedrive-picker-android.

License

The source code is released under:

Copyright (c) 2014 Microsoft Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal i...

If you think the Android project onedrive-picker-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.microsoft.onedrivesdk.common;
/* w  w  w  . j a  va  2 s.  c om*/
import android.content.Intent;
import android.test.AndroidTestCase;

/**
 * All test cases for the clients
 *
 * @author pnied
 */
public class ClientTests extends AndroidTestCase {

    /**
     * Validate that intent creation
     */
    public void testOneDriveIntentCreation() {
        // Setup
        final String expectedAction = "a.b.c.d.e";
        final String expectedAppId = "12341234";
        final int defaultValue = -1;

        // Action
        final Intent result = Client.createOneDriveIntent(expectedAction, expectedAppId);

        // Verify
        assertEquals(expectedAction, result.getAction());
        assertEquals(expectedAppId, result.getStringExtra("appId"));
        assertEquals(2, result.getIntExtra("version", defaultValue));
        assertEquals(1, result.getCategories().size());
        assertEquals(Intent.CATEGORY_DEFAULT, result.getCategories().iterator().next());
    }

    /**
     * Validate that android marketplace intent creation
     */
    public void testAndroidMarketPlaceIntent() {
        // Setup
        final String expectedAction = Intent.ACTION_VIEW;
        final String expectedData = "market://details?id=com.microsoft.skydrive";

        // Action
        final Intent result = Client.createAndroidMarketPlaceIntent();

        // Verify
        assertEquals(expectedAction, result.getAction());
        assertEquals(expectedData, result.getData().toString());
    }

    /**
     * Validate that amazon marketplace intent creation
     */
    public void testAmazonMarketPlaceIntent() {
        // Setup
        final String expectedAction = Intent.ACTION_VIEW;
        final String expectedData = "amzn://apps/android?p=com.microsoft.skydrive";

        // Action
        final Intent result = Client.createAmazonMarketPlaceIntent();

        // Verify
        assertEquals(expectedAction, result.getAction());
        assertEquals(expectedData, result.getData().toString());
    }
}




Java Source Code List

com.example.onedrivesdk.pickersample.PickerMain.java
com.example.onedrivesdk.saversample.SaverMain.java
com.microsoft.onedrivesdk.common.ClientTests.java
com.microsoft.onedrivesdk.common.Client.java
com.microsoft.onedrivesdk.common.TestActivity.java
com.microsoft.onedrivesdk.picker.IPickerResult.java
com.microsoft.onedrivesdk.picker.IPicker.java
com.microsoft.onedrivesdk.picker.LinkType.java
com.microsoft.onedrivesdk.picker.PickerResultTests.java
com.microsoft.onedrivesdk.picker.PickerResult.java
com.microsoft.onedrivesdk.picker.PickerTests.java
com.microsoft.onedrivesdk.picker.Picker.java
com.microsoft.onedrivesdk.saver.ISaver.java
com.microsoft.onedrivesdk.saver.SaverError.java
com.microsoft.onedrivesdk.saver.SaverException.java
com.microsoft.onedrivesdk.saver.SaverTests.java
com.microsoft.onedrivesdk.saver.Saver.java