Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BioEngine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Search", "src\Search\BioEng
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BioEngine.Web", "src\Web\BioEngine.Web.csproj", "{41FD8F9B-A53C-4FAF-B148-335C76EE7A83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BioEngine.Social.Test", "src\BioEngine.Social.Test\BioEngine.Social.Test.csproj", "{7AE14EFA-C077-4C35-9A25-DF81A510BECA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -79,6 +81,10 @@ Global
{41FD8F9B-A53C-4FAF-B148-335C76EE7A83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41FD8F9B-A53C-4FAF-B148-335C76EE7A83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41FD8F9B-A53C-4FAF-B148-335C76EE7A83}.Release|Any CPU.Build.0 = Release|Any CPU
{7AE14EFA-C077-4C35-9A25-DF81A510BECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AE14EFA-C077-4C35-9A25-DF81A510BECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AE14EFA-C077-4C35-9A25-DF81A510BECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AE14EFA-C077-4C35-9A25-DF81A510BECA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 18 additions & 0 deletions src/BioEngine.Social.Test/BioEngine.Social.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02"/>
<PackageReference Include="xunit" Version="2.2.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Social\BioEngine.Social.csproj"/>
</ItemGroup>
<PropertyGroup>
<UserSecretsId>6669c488-cfea-43d0-a0f5-a50c9ee9ca59</UserSecretsId>
</PropertyGroup>
</Project>
42 changes: 42 additions & 0 deletions src/BioEngine.Social.Test/FacebookTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace BioEngine.Social.Test
{
public class FacebookTest
{
private readonly ServiceProvider _services;

public FacebookTest()
{
var config = new ConfigurationBuilder()
.AddUserSecrets("6669c488-cfea-43d0-a0f5-a50c9ee9ca59")
.Build();

var services = new ServiceCollection();
services.AddBioEngineSocial(config);
services.AddLogging();

_services = services.BuildServiceProvider();
}

[Fact]
public async Task TestPostLink()
{
var facebookService = _services.GetService<FacebookService>();

var link = new Uri("https://www.bioware.ru/");

var postId = await facebookService.PostLink(link);

Assert.NotEmpty(postId);

var deleted = await facebookService.DeletePost(postId);

Assert.True(deleted);
}
}
}
3 changes: 3 additions & 0 deletions src/Common/Models/News.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class News : ChildModel<int>

[Required]
public long TwitterId { get; set; }

[Required]
public string FacebookId { get; set; }

[ForeignKey(nameof(AuthorId))]
public virtual User Author { get; set; }
Expand Down
Loading