Skip to content

Commit

Permalink
Subaccount can be assigned an e-mail address
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Jul 24, 2018
1 parent 61e979b commit e12e9ed
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
7 changes: 6 additions & 1 deletion SeatsioDotNet.Test/SeatsioClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ protected SeatsioClientTest()
private TestUser CreateTestUser()
{
var restClient = new RestClient(BaseUrl);
var email = "test" + new Random().Next() + "@seats.io";
var email = RandomEmail();
var password = "12345678";
var request = new RestRequest("/system/public/users", Method.POST)
.AddJsonBody(new {email, password});
return RestUtil.AssertOk(restClient.Execute<TestUser>(request));
}

protected static string RandomEmail()
{
return "test" + new Random().Next() + "@seats.io";
}

protected string CreateTestChart()
{
return CreateTestChartFromJson(TestChartJson());
Expand Down
15 changes: 15 additions & 0 deletions SeatsioDotNet.Test/Subaccounts/CreateSubaccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,20 @@ public void NameIsOptional()

Assert.Null(subaccount.Name);
}

[Fact]
public void TestWithEmail()
{
var email = RandomEmail();
var subaccount = Client.Subaccounts.CreateWithEmail(email);

Assert.NotEqual(0, subaccount.Id);
Assert.NotNull(subaccount.SecretKey);
Assert.NotNull(subaccount.DesignerKey);
Assert.NotNull(subaccount.PublicKey);
Assert.Null(subaccount.Name);
Assert.True(subaccount.Active);
Assert.Equal(email, subaccount.Email);
}
}
}
2 changes: 1 addition & 1 deletion SeatsioDotNet/SeatsioDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<Version>29</Version>
<Version>30</Version>
<Authors>mroloux;bverbeken</Authors>
<Title>Official Seats.io .NET API client</Title>
<Description>Official Seats.io .NET API client</Description>
Expand Down
1 change: 1 addition & 0 deletions SeatsioDotNet/Subaccounts/Subaccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class Subaccount
public string DesignerKey { get; set; }
public string PublicKey { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public bool Active { get; set; }
}
}
7 changes: 7 additions & 0 deletions SeatsioDotNet/Subaccounts/Subaccounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public Subaccount Create(string name)
var restRequest = new RestRequest("/subaccounts", Method.POST)
.AddJsonBody(new {name});
return AssertOk(_restClient.Execute<Subaccount>(restRequest));
}

public Subaccount CreateWithEmail(string email)
{
var restRequest = new RestRequest("/subaccounts", Method.POST)
.AddJsonBody(new {email});
return AssertOk(_restClient.Execute<Subaccount>(restRequest));
}

public Subaccount Retrieve(long id)
Expand Down

0 comments on commit e12e9ed

Please sign in to comment.