-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1191407
commit 071d9d4
Showing
17 changed files
with
468 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Btms.Backend.Data.Mongo; | ||
using FluentAssertions; | ||
using MongoDB.Bson; | ||
using TestDataGenerator.Scenarios; | ||
using TestGenerator.IntegrationTesting.Backend; | ||
using TestGenerator.IntegrationTesting.Backend.Extensions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Btms.Backend.IntegrationTests; | ||
|
||
[Trait("Category", "Integration")] | ||
public class LocalDateTests(ITestOutputHelper output) | ||
: ScenarioGeneratorBaseTest<ChedASimpleMatchFixedDatesScenarioGenerator>(output) | ||
{ | ||
private static readonly DateTime ExpectedDateTime = new DateTime(2024, 12, 1, 10, 10, 0, DateTimeKind.Local); | ||
|
||
[Fact] | ||
public void ShouldBeCorrectInApi() | ||
{ | ||
Client | ||
.GetSingleImportNotification() | ||
.PartOne?.DepartedOn | ||
.Should().Be(ExpectedDateTime); | ||
} | ||
|
||
[Fact] | ||
public void ShouldBeCorrectInMongoDbContext() | ||
{ | ||
var n = BackendFixture.MongoDbContext.Notifications.Single(); | ||
|
||
n.PartOne?.DepartedOn | ||
.Should().Be(ExpectedDateTime); | ||
} | ||
|
||
[Fact] | ||
public void ShouldBeCorrectInDatabase() | ||
{ | ||
var command = @"{ | ||
'find': 'ImportNotification', | ||
projection: {_id:0,'partOne.departedOn':1} | ||
}"; | ||
|
||
var result = ((MongoDbContext)BackendFixture.MongoDbContext) | ||
.Database.RunCommand<BsonDocument>(command); | ||
|
||
result["cursor"]["firstBatch"][0]["partOne"]["departedOn"].AsBsonDateTime | ||
.Should().Be(new BsonDateTime(ExpectedDateTime)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.