public void GetAllVars() { // Arrange var context = new TestCaseContext(); var sut = new VarsManager( context.OptionsService, context.Logger); var random = new Random(); int varsCount = 5; var vars = new List <IVar>(); for (int i = 0; i < varsCount; ++i) { vars.Add(new IntVar( $"key{i}", $"var-name{i}", random.Next(-100, 100))); } // Act foreach (var v in vars) { sut.AddVar(v); } var actual = sut.GetAllVars(); // Assert Assert.Equal(vars, actual); }
public void Init() { // Arrange var context = new TestCaseContext(); var sut = new VarsManager( context.OptionsService, context.Logger); var userName = "******"; var vars = new List <IVar> { new IntVar("v1", "v1-name", 0), new IntVar("v2", "v2-name", 1), new IntVar("v3", "v3-name", 2), }; // Act sut.Init(userName, vars); var allVars = sut.GetAllVars(); var userNameVar = sut.GetVar <StringVar>(context.Options.UserNameVarKey); // Assert Assert.Equal(vars.Count + 1, allVars.Count()); Assert.Equal(userName, userNameVar.Value); }
public void ClearVars() { // Arrange var context = new TestCaseContext(); var sut = new VarsManager( context.OptionsService, context.Logger); int varsCount = 3; var vars = new List <IntVar>(); for (int i = 0; i < varsCount; ++i) { sut.AddVar(new IntVar($"key{i}", $"var-name{i}")); } // Act sut.ClearVars(); // Assert Assert.Empty(sut.GetAllVars()); }