using System;
using System.Security.Authentication;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tango.BL;
using Tango.Transport.Web;
using System.Linq;
using Tango.PPC.Common.Web;
using Tango.Core.IO;
namespace Tango.UnitTesting.MachineService
{
[TestClass]
[TestCategory("Machine Service - PPC")]
public class PPC_Controller_TST
{
private const string address = "https://machineservice-test.twine-srv.com";
[TestMethod]
public void Login_and_setup()
{
//Now check the dedicated machine studio client.
PPCWebClient client = new PPCWebClient(address, null);
//Should throw an exception without login first (no token specified..)
Assert.ThrowsException<AuthenticationException>(() =>
{
var res1 = client.MachineSetup(new MachineSetupRequest()
{
}).GetAwaiter().GetResult();
});
//Perform a login with user mode.
var res2 = client.Login(new LoginRequest()
{
Mode = LoginMode.User,
Email = "TestUser@twine-s.com",
Password = "ASJH_asdjkl1234",
}).Result;
//Should throw exception about serial number not found.