public void Setup_Null_ArgumentNullException() { // Arrange var target = new InitializationList(); // Act target.Setup(null); }
private void CreateInitializationList(object sender, RoutedEventArgs e) { //Validate Inputs if (!IsValidInputs()) { return; } //Reset InitializationList.Clear(); InitializationPanel.Children.Clear(); //Add vertical Line for start day Grid verticalLine = ShapeService.GetVerticalLineWithNumber(0); InitializationPanel.Children.Add(verticalLine); //Set DefaultType DefaultType = DefaultHouseTypeIsActive.IsChecked == true ? HouseType.Аctive : HouseType.Inactive; //Set DefaultUrlPicture DefaultUrlPicture = DefaultType == HouseType.Аctive ? UrlPicture.ACTIVE_HOUSE : UrlPicture.INACTIVE_HOUSE; //Set NumberOfElements NumberOfElements = int.Parse(NumberOfHouses.Text); for (int i = 0; i < NumberOfElements; i++) { InitializationList.Add(new House { Number = i + 1, UrlPicture = DefaultUrlPicture, HouseType = DefaultType, }); StackPanel wrapper = new StackPanel(); Grid horizontalLine = ShapeService.GetHorizontalLineWithNumber(i + 1); Image image = ShapeService.GetImage(); Binding binding = new Binding(); binding.Source = InitializationList; binding.Path = new PropertyPath($"[{i}].UrlPicture"); image.SetBinding(Image.SourceProperty, binding); Button button = ShapeService.GetButton(); button.Click += ReverseImage; button.CommandParameter = i; wrapper.Children.Add(horizontalLine); wrapper.Children.Add(image); wrapper.Children.Add(button); InitializationPanel.Children.Add(wrapper); } }
public void IsEmpty_NewInstance_True() { // Arrange var target = new InitializationList(); // Act var result = target.IsEmpty; // Verify Assert.IsFalse(result); }
public void Values_NewInstance_Null() { // Arrange var target = new InitializationList(); // Act var result = target.Values; // Verify Assert.IsNull(result); }
public void Setup_2ValuesAndNotInitialized_ReturnsTrue() { // Arrange var target = new InitializationList(); // Act var result = target.Setup(new string[] { "team1", "team2" }); // Verify Assert.IsTrue(result); }
public void ContainsOrNotInit_NotInitialized_ReturnsTrue() { // Arrange var target = new InitializationList(); // Act var result = target.ContainsOrNotInit("team2"); // Verify Assert.IsTrue(result); }
public void Clear_NoInitialization_IsEmpty() { // Arrange var target = new InitializationList(); // Act target.Clear(); // Verify Assert.IsTrue(target.IsEmpty); CollectionAssert.AreEquivalent(new string[0], target.Values.ToList()); }
public void Setup_2ValuesAndClearedAlready_ReturnsFalse() { // Arrange var target = new InitializationList(); target.Clear(); // Act var result = target.Setup(new string[] { "team3", "team4" }); // Verify Assert.IsFalse(result); }
public void Setup_2ValuesAndNotInitialized_ValuesAreSet() { // Arrange var target = new InitializationList(); // Act target.Setup(new string[] { "team1", "team2" }); // Verify Assert.IsFalse(target.IsEmpty); Assert.IsNotNull(target.Values); CollectionAssert.AreEquivalent(new string[] { "team1", "team2" }, target.Values.ToList()); }
public void ContainsOrNotInit_Empty_ReturnsFalse() { // Arrange var target = new InitializationList(); target.Clear(); // Act var result = target.ContainsOrNotInit("team3"); // Verify Assert.IsFalse(result); }
public void ContainsOrNotInit_NonexistingValue_ReturnsFalse() { // Arrange var target = new InitializationList(); target.Setup(new string[] { "team1", "team2" }); // Act var result = target.ContainsOrNotInit("team3"); // Verify Assert.IsFalse(result); }
public void Remove_ExistingValue_ReturnsTrue() { // Arrange var target = new InitializationList(); target.Setup(new string[] { "team1", "team2" }); // Act var result = target.Remove("team2"); // Verify Assert.IsTrue(result); }
public void Clear_AfterInitialization_IsEmpty() { // Arrange var target = new InitializationList(); target.Setup(new string[] { "team1", "team2" }); // Act target.Clear(); // Verify Assert.IsTrue(target.IsEmpty); CollectionAssert.AreEquivalent(Array.Empty <string>(), target.Values.ToList()); }
public void Remove_NonexistingValue_CollectionIsSame() { // Arrange var target = new InitializationList(); target.Setup(new string[] { "team1", "team2" }); // Act target.Remove("team3"); // Verify CollectionAssert.AreEquivalent(new string[] { "team1", "team2" }, target.Values.ToList()); Assert.IsFalse(target.IsEmpty); }
public void Remove_OnlyValue_CollectionIsEmpty() { // Arrange var target = new InitializationList(); target.Setup(new string[] { "team2", "team2" }); // Act target.Remove("team2"); // Verify CollectionAssert.AreEquivalent(new string[0], target.Values.ToList()); Assert.IsTrue(target.IsEmpty); }
public void Setup_2ValuesAndClearedAlready_ValuesAreNotSet() { // Arrange var target = new InitializationList(); target.Clear(); // Act target.Setup(new string[] { "team3", "team4" }); // Verify Assert.IsTrue(target.IsEmpty); Assert.IsNotNull(target.Values); CollectionAssert.AreEquivalent(new string[0], target.Values.ToList()); }
public PlantState(string type) { plantType = type; desiredValues = PlantGenerator.Get.GetPlantValues(type); }
public void RestartValues(string type) { plantType = type; desiredValues = PlantGenerator.Get.GetPlantValues(type); }