Files
2026-04-17 14:55:32 -04:00

105 lines
3.3 KiB
C#

using GroupList.Model;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.DataModel.Tests
{
[TestFixture]
public class GroupShould
{
[Test]
public void Filter_ShouldReturnTrueOnEmptyTerm()
{
Group sut = new Group();
var res = sut.Filter("");
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueOnNullTerm()
{
Group sut = new Group();
var res = sut.Filter(null);
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenAssociatedTestSetupsIsNull()
{
Group sut = new Group();
var res = sut.Filter("abc");
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTerm()
{
Group sut = new Group();
sut.DisplayName = "defabchy";
var res = sut.Filter("abc");
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTermDescription()
{
Group sut = new Group();
sut.Description = "defabchy";
var res = sut.Filter("abc");
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTermChannelCount()
{
Group sut = new Group();
sut.AssociatedTestSetups = new List<Interface.Groups.GroupList.TestSetupParentHelper>();
sut.ChannelCount = 3;
var res = sut.Filter("3");
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTermNotfound()
{
Group sut = new Group();
sut.AssociatedTestSetups = new List<Interface.Groups.GroupList.TestSetupParentHelper>();
var res = sut.Filter("178");
Assert.That(res, Is.False);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTermLastModifiedfound()
{
Group sut = new Group();
sut.AssociatedTestSetups = new List<Interface.Groups.GroupList.TestSetupParentHelper>();
var now = DateTime.Now;
sut.LastModified = now;
var res = sut.Filter(now.ToString());
Assert.That(res, Is.True);
}
[Test]
public void Filter_ShouldReturnTrueWhenfindTermLastModifiedNotfound()
{
Group sut = new Group();
sut.AssociatedTestSetups = new List<Interface.Groups.GroupList.TestSetupParentHelper>();
var now = DateTime.Now;
sut.LastModified = now.AddMonths(5);
var res = sut.Filter(now.ToString());
Assert.That(res, Is.False);
}
[Test]
public void ConvertToEmbedded_ShouldThrowNoExceptionIfEmbeddedAlready()
{
Group sut = new Group();
sut.Embedded = true;
sut.ConvertToEmbedded(new List<Interface.Channels.IGroupChannel>().ToArray());
Assert.That(sut.Embedded, Is.True);
}
}
}