aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'EventMaker/UnitTests/UnitTest.cs')
-rw-r--r--EventMaker/UnitTests/UnitTest.cs32
1 files changed, 30 insertions, 2 deletions
diff --git a/EventMaker/UnitTests/UnitTest.cs b/EventMaker/UnitTests/UnitTest.cs
index 0939520..d8481ae 100644
--- a/EventMaker/UnitTests/UnitTest.cs
+++ b/EventMaker/UnitTests/UnitTest.cs
@@ -1,18 +1,46 @@
using System;
+using System.Collections.ObjectModel;
using Windows.UI.Popups;
using EventMaker.Model;
+using EventMaker.ViewModel;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
namespace UnitTests
{
[TestClass]
- public class UnitTest1
+ public class UnitTest
{
[TestMethod]
public void AddingTestMethod()
{
EventCatalogSingleton eventCatalogSingleton = EventCatalogSingleton.Instance;
- EventCatalogSingleton.Instance.Add(new Event() { Id = 1, Name = "Party", Description = "Best party ever!", Place = "Roskilde" });
+ eventCatalogSingleton.Events=new ObservableCollection<Event>();
+ eventCatalogSingleton.Add(new Event());
+ Assert.AreEqual(1, eventCatalogSingleton.Events.Count);
}
+
+ [TestMethod]
+ public void RemovingTestMethod()
+ {
+ EventCatalogSingleton eventCatalogSingleton = EventCatalogSingleton.Instance;
+ eventCatalogSingleton.Events = new ObservableCollection<Event>();
+ eventCatalogSingleton.Add(new Event());
+ Assert.AreEqual(1,eventCatalogSingleton.Events.Count);
+ eventCatalogSingleton.Remove(0);
+ Assert.AreEqual(0,eventCatalogSingleton.Events.Count);
+ }
+
+ [TestMethod]
+ public void EditTestMethod()
+ {
+ EventCatalogSingleton eventCatalogSingleton = EventCatalogSingleton.Instance;
+ eventCatalogSingleton.Events = new ObservableCollection<Event>();
+ eventCatalogSingleton.Add(new Event() {Id=0});
+ Assert.AreEqual(1, eventCatalogSingleton.Events.Count);
+ Assert.AreEqual(0,eventCatalogSingleton.Events[0].Id);
+ eventCatalogSingleton.Update(0,new Event() {Id=1});
+ Assert.AreEqual(1,eventCatalogSingleton.Events[0].Id);
+ }
+
}
}