-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathGenericExtensionsTests.cs
More file actions
49 lines (43 loc) · 1.37 KB
/
GenericExtensionsTests.cs
File metadata and controls
49 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using FluentAssertions;
using Azure.Functions.Cli.Extensions;
using Xunit;
namespace Azure.Functions.Cli.Tests.ExtensionsTests
{
public class GenericExtensionsTests
{
class Source
{
public string name { get; set; }
public int value { get; set; }
public DateTime timestamp { get; set; }
public Test direction { get; set; }
public Test from { get; set; }
}
class Target
{
public string Name { get; set; }
public int Value { get; set; }
public DateTime? Timestamp { get; set; }
public Test? Direction { get; set; }
public Test From { get; set; }
}
enum Test
{
North,
South
}
[Fact]
public void MergeWithTest()
{
var source = new Source { name = "Original", value = 10, timestamp = DateTime.UtcNow, direction = Test.South, from = Test.South };
var target = new Target();
target = target.MergeWith(source, t => t);
target.Name.Should().Be(source.name);
target.Value.Should().Be(source.value);
target.Timestamp.Should().Be(source.timestamp);
target.Direction.Should().Be(source.direction);
target.From.Should().Be(source.from);
}
}
}