using Data; using Data.EF; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.VisualStudio.TestTools.UnitTesting; using Model.Dice; using Model.Dice.Faces; using Model.Games; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Tests.Data_UTs.Dice { public class DiceGroupManagerTest { private readonly MasterOfCeremonies stubGameRunner = new Stub().LoadApp(); [Fact] public void TestConstructorReturnsEmptyEnumerable() { // Arrange DiceGroupManager diceGroupManager = new(); Dictionary> expected; Dictionary> actual; // Act expected = new Dictionary>(); actual = (Dictionary>)diceGroupManager.GetAll(); // Assert Xunit.Assert.Equal(expected, actual); } [Fact] public void TestAddWhenDiceGroupThenDoAddAndReturnDiceGroup() { // Arrange DiceGroupManager dgm = new(); KeyValuePair> group1 = stubGameRunner.DiceGroupManager.GetAll().First(); KeyValuePair> group2 = stubGameRunner.DiceGroupManager.GetAll().Last(); // Act //...adding keys and values to some dictionary for future comparison Dictionary> expected = new() { { group1.Key, group1.Value }, { group2.Key, group2.Value } }; //...storing the results of DiceGroupManager.Add() in variables KeyValuePair> resultFromAdd1 = dgm.Add(group1); KeyValuePair> resultFromAdd2 = dgm.Add(group2); //...using those variables to fill a second dictionary for comparison Dictionary> actual = new() { { resultFromAdd1.Key, resultFromAdd1.Value }, { resultFromAdd2.Key, resultFromAdd2.Value } }; // Assert Xunit.Assert.Equal(expected, actual); } } }