mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-15 14:59:30 +00:00
7e9c3c5f64
* Create unit tests Rearrange test project structure Implement ICVLoggerProvider interface for mocking/extensibility * Fix UTs project path
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using FluentAssertions;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Moq;
|
|
using System.Windows.Extensions;
|
|
|
|
namespace WpfExtended.Tests.Configuration
|
|
{
|
|
[TestClass]
|
|
public class LiveUpdateableOptionsWrapperTests
|
|
{
|
|
private LiveUpdateableOptionsWrapper<string> optionsWrapper;
|
|
private readonly Mock<IOptionsManager> optionsManagerMock = new();
|
|
|
|
[TestInitialize]
|
|
public void TestInitialize()
|
|
{
|
|
this.optionsWrapper = new LiveUpdateableOptionsWrapper<string>(optionsManagerMock.Object);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetValue_ReturnsValue()
|
|
{
|
|
this.optionsManagerMock
|
|
.Setup(u => u.GetOptions<string>())
|
|
.Returns("hello");
|
|
|
|
var value = this.optionsWrapper.Value;
|
|
|
|
value.Should().Be("hello");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void UpdateOption_CallsOptionsManager()
|
|
{
|
|
this.optionsManagerMock
|
|
.Setup(u => u.UpdateOptions<string>(It.IsAny<string>()))
|
|
.Verifiable();
|
|
|
|
this.optionsWrapper.UpdateOption();
|
|
|
|
this.optionsManagerMock.Verify();
|
|
}
|
|
}
|
|
}
|