-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUnitTestDog.cs
43 lines (33 loc) · 974 Bytes
/
UnitTestDog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ConsoleAppEventsDelegates;
using System.ComponentModel;
using System.Collections.Generic;
namespace UnitTestProjectDogEvent
{
[TestClass]
public class UnitTestDog
{
DogEvent dog;
public UnitTestDog()
{
dog = new DogEvent();
}
[TestMethod]
public void DogINotifyPropertyChanged()
{
//Arrange
List<string> receivedEvents = new List<string>();
dog.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e)
{
receivedEvents.Add(e.PropertyName);
};
//Act
dog.Name = "something";
dog.BarkSound = "something";
//Assert
Assert.AreEqual("Name", receivedEvents[0]);
Assert.AreEqual("BarkSound", receivedEvents[1]);
}
}
}