Skip to content
Browse files

updated

  • Loading branch information...
2 parents eb4e4f4 + af96b9e commit 23882661a210197fb93d8ea25383f0b3bc31d9a7 @mohanmca committed
Showing with 809 additions and 45 deletions.
  1. 0 Learnings/GITHUB.txt
  2. 0 Learnings/NInject.txt
  3. 0 Learnings/NUnit.txt
  4. +18 −0 Learnings/Philosophies.txt
  5. +30 −0 Learnings/TDD.txt
  6. BIN WhatNEXT/NInjectBinaries/Ninject.dll
  7. +26 −0 WhatNEXT/WhatNEXT/ConsoleTaskEventNotifier.cs
  8. +19 −0 WhatNEXT/WhatNEXT/Enums.cs
  9. +14 −0 WhatNEXT/WhatNEXT/ITaskList.cs
  10. +12 −0 WhatNEXT/WhatNEXT/ITaskListWithEvents.cs
  11. 0 WhatNEXT/{NInjectBinaries → WhatNEXT/NinjectBinaries}/LICENSE.txt
  12. BIN WhatNEXT/WhatNEXT/NinjectBinaries/Ninject.dll
  13. BIN WhatNEXT/{NInjectBinaries → WhatNEXT/NinjectBinaries}/Ninject.pdb
  14. +0 −45 WhatNEXT/{NInjectBinaries → WhatNEXT/NinjectBinaries}/Ninject.xml
  15. BIN ...T/{NInjectBinaries → WhatNEXT/NinjectBinaries}/extensions/CommonServiceLocator.NinjectAdapter.dll
  16. BIN ...T/{NInjectBinaries → WhatNEXT/NinjectBinaries}/extensions/CommonServiceLocator.NinjectAdapter.pdb
  17. +81 −0 WhatNEXT/WhatNEXT/SimpleTaskList.cs
  18. +23 −0 WhatNEXT/WhatNEXT/TaskAddEventArgs.cs
  19. +9 −0 WhatNEXT/WhatNEXT/TaskDelegates.cs
  20. +77 −0 WhatNEXT/WhatNEXT/TaskEventGenerator.cs
  21. +9 −0 WhatNEXT/WhatNEXT/TaskItem.cs
  22. +60 −0 WhatNEXT/WhatNEXT/TaskListFactory.cs
  23. +47 −0 WhatNEXT/WhatNEXT/Utility.cs
  24. +152 −0 WhatNEXT/WhatNEXT/WhatNEXT.5.1.ReSharper.user
  25. +38 −0 WhatNEXT/WhatNEXT/WhatNEXT.csproj
  26. BIN WhatNEXT/WhatNEXT/WhatNEXT.suo
  27. +144 −0 WhatNEXTTests/WhatNEXT.Tests/SimpleTaskListTests.cs
  28. +34 −0 WhatNEXTTests/WhatNEXT.Tests/TaskEventGeneratorTests.cs
  29. +16 −0 WhatNEXTTests/WhatNEXT.Tests/WhatNEXT.Tests.csproj
View
0 Learnings/GITHUB.txt
No changes.
View
0 Learnings/NInject.txt
No changes.
View
0 Learnings/NUnit.txt
No changes.
View
18 Learnings/Philosophies.txt
@@ -0,0 +1,18 @@
+1. A Task at a time - Reminder also only one task at a time
+
+2. SRP - Single Responsibility
+
+3. better late than never
+
+4. Prefer simplicity over features.
+
+5. Early To Fail or Fast to Break.
+
+6. 5 tasks are in right format. but one task is not in correct format.
+ Fail all import tasks/export tasks.
+
+
+7. Black Swan Theory.
+
+
+8.
View
30 Learnings/TDD.txt
@@ -0,0 +1,30 @@
+Test Driven Development - TDD
+===============================
+
+1. Test First Development - Write Tests->Fail Tests->Write Code->Run Tests--->Fix Bugs-->No Bugs--->Refactor if required.
+
+2. Red (Test's Fail)-Green (Tests's Pass)-Refactor(Renaming method, splitting complex method into multiple etc).
+
+3. Entity classes - Pure getter and setter alone, should not have Unit Tests. No need. waste of time.
+
+4. Test should force the design changes. If a module is not testable, need to change the design.
+
+5. Each TestCase should be stateless
+
+6. A test case should test the core functionality. Not getters and setters.
+
+7. Develop everything as stateless. You develop differently.
+
+
+
+
+
+
+
+
+
+
+
+References:
+==============
+The Art of UNIT TESTING with Examples in .NET - ROY OSHEROVE
View
BIN WhatNEXT/NInjectBinaries/Ninject.dll
Binary file not shown.
View
26 WhatNEXT/WhatNEXT/ConsoleTaskEventNotifier.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public static class ConsoleTaskEventNotifier
+ {
+ private static ITaskList taskListWithEvents;
+
+ public static void TaskEventNotifier(ITaskList taskList)
+ {
+ if(taskList != null)
+ {
+ ((ITaskListWithEvents)taskList).Add += new AddTaskEventHandler(ConsoleTaskEventNotifier_Add);
+ }
+ }
+ static void ConsoleTaskEventNotifier_Add(object sender, TaskAddEventArgs e)
+ {
+ Console.WriteLine("Task id added: {0}", e.TaskID);
+ }
+
+
+ }
+}
View
19 WhatNEXT/WhatNEXT/Enums.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public static class Enumerations
+ {
+ public enum ContentType
+ {
+ JSON,
+ XML,
+ CSV
+ } ;
+
+
+ }
+}
View
14 WhatNEXT/WhatNEXT/ITaskList.cs
@@ -2,15 +2,29 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+<<<<<<< HEAD
+=======
+using System.IO;
+>>>>>>> upstream/master
namespace WhatNEXT
{
public interface ITaskList
{
+<<<<<<< HEAD
void AddTask(TaskItem taskItem);
void UpdateTask(TaskItem taskItem);
TaskItem FindTaskByID(string taskID);
long GetCount();
+=======
+ void AddTask(TaskItem taskItem);
+ void UpdateTask(TaskItem taskItem);
+ TaskItem FindTaskByID(Int64 taskID);
+ Int64 GetCount();
+ void DeleteTask(TaskItem taskItem);
+ byte[] ExportTask(List<TaskItem> taskItems, Enumerations.ContentType contentType);
+ List<TaskItem> GetAll();
+>>>>>>> upstream/master
}
}
View
12 WhatNEXT/WhatNEXT/ITaskListWithEvents.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public interface ITaskListWithEvents: ITaskList
+ {
+ event AddTaskEventHandler Add;
+ }
+}
View
0 WhatNEXT/NInjectBinaries/LICENSE.txt → ...NEXT/WhatNEXT/NinjectBinaries/LICENSE.txt
File renamed without changes.
View
BIN WhatNEXT/WhatNEXT/NinjectBinaries/Ninject.dll
Binary file not shown.
View
BIN WhatNEXT/NInjectBinaries/Ninject.pdb → ...NEXT/WhatNEXT/NinjectBinaries/Ninject.pdb
Binary file not shown.
View
45 WhatNEXT/NInjectBinaries/Ninject.xml → ...NEXT/WhatNEXT/NinjectBinaries/Ninject.xml
@@ -1816,11 +1816,6 @@
Gets the callback for thread scope.
</summary>
</member>
- <member name="F:Ninject.Infrastructure.StandardScopeCallbacks.Request">
- <summary>
- Gets the callback for request scope.
- </summary>
- </member>
<member name="T:Ninject.Injection.ConstructorInjector">
<summary>
A delegate that can inject values into a constructor.
@@ -2779,12 +2774,6 @@
Indicates that instances activated via the binding should be re-used within the same thread.
</summary>
</member>
- <member name="M:Ninject.Syntax.IBindingInSyntax`1.InRequestScope">
- <summary>
- Indicates that instances activated via the binding should be re-used within the same
- HTTP request.
- </summary>
- </member>
<member name="M:Ninject.Syntax.IBindingInSyntax`1.InScope(System.Func{Ninject.Activation.IContext,System.Object})">
<summary>
Indicates that instances activated via the binding should be re-used as long as the object
@@ -3061,12 +3050,6 @@
Indicates that instances activated via the binding should be re-used within the same thread.
</summary>
</member>
- <member name="M:Ninject.Planning.Bindings.BindingBuilder`1.InRequestScope">
- <summary>
- Indicates that instances activated via the binding should be re-used within the same
- HTTP request.
- </summary>
- </member>
<member name="M:Ninject.Planning.Bindings.BindingBuilder`1.InScope(System.Func{Ninject.Activation.IContext,System.Object})">
<summary>
Indicates that instances activated via the binding should be re-used as long as the object
@@ -4631,34 +4614,6 @@
<c>true</c> if null is allowed as injected value otherwise false.
</value>
</member>
- <member name="T:Ninject.OnePerRequestModule">
- <summary>
- Provides callbacks to more aggressively collect objects scoped to HTTP requests.
- </summary>
- </member>
- <member name="M:Ninject.OnePerRequestModule.Init(System.Web.HttpApplication)">
- <summary>
- Initializes the module.
- </summary>
- <param name="application">The <see cref="T:System.Web.HttpApplication"/> whose instances will be managed.</param>
- </member>
- <member name="M:Ninject.OnePerRequestModule.StartManaging(Ninject.IKernel)">
- <summary>
- Start managing instances for the specified kernel.
- </summary>
- <param name="kernel">The kernel.</param>
- </member>
- <member name="M:Ninject.OnePerRequestModule.StopManaging(Ninject.IKernel)">
- <summary>
- Stops managing instances for the specified kernel.
- </summary>
- <param name="kernel">The kernel.</param>
- </member>
- <member name="M:Ninject.OnePerRequestModule.DeactivateInstancesForCurrentHttpRequest">
- <summary>
- Deactivates instances owned by the current <see cref="T:System.Web.HttpContext"/>.
- </summary>
- </member>
<member name="T:Ninject.StandardKernel">
<summary>
The standard implementation of a kernel.
View
BIN ...s/CommonServiceLocator.NinjectAdapter.dll → ...s/CommonServiceLocator.NinjectAdapter.dll
Binary file not shown.
View
BIN ...s/CommonServiceLocator.NinjectAdapter.pdb → ...s/CommonServiceLocator.NinjectAdapter.pdb
Binary file not shown.
View
81 WhatNEXT/WhatNEXT/SimpleTaskList.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+<<<<<<< HEAD
using System.Linq;
using System.Text;
using System.Threading;
@@ -7,6 +8,18 @@
namespace WhatNEXT
{
public class SimpleTaskList: ITaskList
+=======
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Xml.Serialization;
+
+
+namespace WhatNEXT
+{
+ public class SimpleTaskList : ITaskList
+>>>>>>> upstream/master
{
private List<TaskItem> taskItems = new List<TaskItem>();
@@ -15,6 +28,7 @@ public List<TaskItem> TaskItems
get { return taskItems; }
}
+<<<<<<< HEAD
public void AddTask(TaskItem taskItem)
{
if (taskItem != null)
@@ -31,6 +45,29 @@ public void UpdateTask(TaskItem taskItemUpdated)
TaskItem taskItemCurrent = FindTaskByID(taskItemUpdated.ID.ToString());
if(taskItemCurrent != null)
+=======
+ public SimpleTaskList()
+ {
+ Console.WriteLine("from simpletasklist added");
+ }
+
+ public void AddTask(TaskItem taskItem)
+ {
+
+
+ if (taskItem == null || null != FindTaskByID(taskItem.ID))
+ {
+ throw new ApplicationException("");
+ }
+ TaskItems.Add(taskItem);
+
+ }
+ public void UpdateTask(TaskItem taskItemUpdated)
+ {
+ TaskItem taskItemCurrent = FindTaskByID(taskItemUpdated.ID);
+
+ if (taskItemCurrent != null)
+>>>>>>> upstream/master
{
TaskItems[TaskItems.IndexOf(taskItemCurrent)] = taskItemUpdated;
}
@@ -39,6 +76,7 @@ public void UpdateTask(TaskItem taskItemUpdated)
throw new ApplicationException();
}
}
+<<<<<<< HEAD
public TaskItem FindTaskByID(string taskID)
{
TaskItem taskItem = TaskItems.Find((t) => t.ID == Convert.ToInt64(taskID));
@@ -49,6 +87,14 @@ public TaskItem FindTaskByID(string taskID)
throw new ApplicationException();
}
+=======
+ public TaskItem FindTaskByID(Int64 taskID)
+ {
+
+ return TaskItems.Find((t) => t.ID == taskID);
+
+ }
+>>>>>>> upstream/master
public long GetCount()
{
return TaskItems.Count;
@@ -58,5 +104,40 @@ private int GetIndexOfTaskItem(TaskItem t)
{
return TaskItems.IndexOf(t);
}
+<<<<<<< HEAD
+=======
+
+ public override string ToString()
+ {
+ return base.ToString() + " SimpleTaskList";
+ }
+
+ public void DeleteTask(TaskItem taskItem)
+ {
+
+ bool isTaskItemRemoved = TaskItems.Remove(taskItem);
+
+ if (isTaskItemRemoved == false)
+ {
+ throw new ApplicationException();
+ }
+ }
+
+ public byte[] ExportTask(List<TaskItem> taskItems, Enumerations.ContentType contentType)
+ {
+ var xmlSerializer = new XmlSerializer(typeof(List<TaskItem>));
+
+ MemoryStream memoryStream = new MemoryStream();
+ xmlSerializer.Serialize(memoryStream, taskItems);
+
+ return memoryStream.GetBuffer();
+
+ }
+
+ public List<TaskItem> GetAll()
+ {
+ return TaskItems;
+ }
+>>>>>>> upstream/master
}
}
View
23 WhatNEXT/WhatNEXT/TaskAddEventArgs.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public class TaskAddEventArgs:EventArgs
+ {
+ private Int64 taskID;
+
+ public long TaskID
+ {
+ get { return taskID; }
+ private set { taskID = value; }
+ }
+
+ public TaskAddEventArgs(Int64 taskID)
+ {
+ TaskID = taskID;
+ }
+ }
+}
View
9 WhatNEXT/WhatNEXT/TaskDelegates.cs
@@ -0,0 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public delegate void AddTaskEventHandler(object sender, TaskAddEventArgs e);
+}
View
77 WhatNEXT/WhatNEXT/TaskEventGenerator.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public class TaskEventGenerator : ITaskListWithEvents
+ {
+ private ITaskList taskList;//why private - outside world should not know. proxy attendance cannot given public
+ public event AddTaskEventHandler Add;
+
+
+ public TaskEventGenerator(ITaskList taskList)
+ {
+ this.taskList = taskList;
+
+ Console.WriteLine("from TaskEventGenerator added");
+ }
+ // Invoke the Changed event; called whenever list changes
+ protected virtual void OnAdd(TaskAddEventArgs e)
+ {
+ if (Add != null)
+ {
+ Add(this, e);
+ }
+
+ }
+ public void AddTask(TaskItem taskItem)
+ {
+ taskList.AddTask(taskItem);
+ OnAdd(new TaskAddEventArgs(taskItem.ID));
+ }
+ public void UpdateTask(TaskItem taskItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ public TaskItem FindTaskByID(long taskID)
+ {
+ return taskList.FindTaskByID(taskID);
+ }
+
+ public long GetCount()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void DeleteTask(TaskItem taskItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ public byte[] ExportTask(List<TaskItem> taskItems, Enumerations.ContentType contentType)
+ {
+
+ throw new NotImplementedException();
+ }
+
+ public List<TaskItem> GetAll()
+ {
+ throw new NotImplementedException();
+ }
+
+ public static void Main()
+ {
+ ITaskList t = TaskListFactory.GetInstance().CreateList();
+
+ ConsoleTaskEventNotifier.TaskEventNotifier(t);
+
+ t.AddTask(new TaskItem() { ID = 1 });
+
+ System.Threading.Thread.Sleep(10000);
+
+ }
+ }
+}
View
9 WhatNEXT/WhatNEXT/TaskItem.cs
@@ -10,6 +10,15 @@ public class TaskItem
{
public Int64 ID { get; set; }
public string Details { get; set; }
+<<<<<<< HEAD
public IPAddress IpAddress { get; set; }
+=======
+ public string IpAddress { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ return ID == ((TaskItem) obj).ID;
+ }
+>>>>>>> upstream/master
}
}
View
60 WhatNEXT/WhatNEXT/TaskListFactory.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Ninject;
+
+namespace WhatNEXT
+{
+ public class TaskListFactory
+ {
+ private static TaskListFactory tasklistFactory = null; //new TaskListFactory();
+ private static IKernel kernel;
+
+ public TaskListFactory()
+ {
+
+ }
+ private static void BootStrap()
+ {
+ kernel = new StandardKernel();
+
+ kernel.Bind<ITaskList>().To<TaskEventGenerator>();//TaskEventGenerator
+ //kernel.Bind<ITaskListWithEvents>().To<TaskEventGenerator>();
+ kernel.Bind<ITaskList>().To<SimpleTaskList>().WhenInjectedInto<TaskEventGenerator>();
+
+ //kernel.Bind<TaskListFactory>().ToSelf();
+
+ tasklistFactory = kernel.Get<TaskListFactory>();
+
+ }
+
+ public static TaskListFactory GetInstance()
+ {
+
+ if (tasklistFactory == null)
+ {
+ BootStrap();
+ }
+
+ return tasklistFactory;
+
+ }
+ public ITaskList CreateList()
+ {
+
+ return kernel.Get<ITaskList>();
+ }
+ public ITaskListWithEvents CreateTaskListWithEvents()
+ {
+ return kernel.Get<ITaskListWithEvents>();
+ }
+
+ public static void Main()
+ {
+ Console.WriteLine(TaskListFactory.GetInstance().CreateList());
+ }
+
+
+ }
+}
View
47 WhatNEXT/WhatNEXT/Utility.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace WhatNEXT
+{
+ public static class Utility
+ {
+ public static int GetSizeOfObject(object obj)
+ {
+ //object v = null;
+ //int size = 0;
+ //Type type = obj.GetType();
+ //PropertyInfo[] info = type.GetProperties();
+ //foreach (PropertyInfo property in info)
+ //{
+ // v = property.GetValue(obj, null);
+ // unsafe
+ // {
+ // size += sizeof(v);
+ // }
+ //}
+ //return size;
+
+ return 100000;
+
+
+ }
+
+ public static byte[] GetByteArray(Stream input)
+ {
+ byte[] buffer = new byte[16 * 1024];
+ using (MemoryStream ms = new MemoryStream())
+ {
+ int read;
+ while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ ms.Write(buffer, 0, read);
+ }
+ return ms.ToArray();
+ }
+ }
+ }
+}
View
152 WhatNEXT/WhatNEXT/WhatNEXT.5.1.ReSharper.user
@@ -0,0 +1,152 @@
+<Configuration>
+ <SettingsComponent>
+ <string />
+ <integer />
+ <boolean>
+ <setting name="SolutionAnalysisEnabled">False</setting>
+ </boolean>
+ </SettingsComponent>
+ <RecentFiles>
+ <RecentFiles>
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:ITaskList.cs" caret="316" fromTop="12" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:Program.cs" caret="218" fromTop="16" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="450" fromTop="15" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:SimpleTaskList.cs" caret="1653" fromTop="17" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="371" fromTop="20" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskItem.cs" caret="300" fromTop="12" />
+ </RecentFiles>
+ <RecentEdits>
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:SimpleTaskList.cs" caret="922" fromTop="14" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="259" fromTop="12" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="259" fromTop="21" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="416" fromTop="25" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="259" fromTop="0" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="574" fromTop="13" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="2397" fromTop="26" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="3047" fromTop="11" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="2075" fromTop="33" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1620" fromTop="17" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1762" fromTop="20" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1959" fromTop="12" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1632" fromTop="6" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="2442" fromTop="21" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="3047" fromTop="20" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="925" fromTop="9" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1256" fromTop="15" />
+ <File id="9821CB5D-BC5F-4CF2-BF87-F8EE06188C42/f:SimpleTaskListTests.cs" caret="1500" fromTop="19" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:ITaskList.cs" caret="304" fromTop="12" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:SimpleTaskList.cs" caret="1091" fromTop="9" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:SimpleTaskList.cs" caret="780" fromTop="27" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:Program.cs" caret="227" fromTop="16" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="104" fromTop="4" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="855" fromTop="31" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="364" fromTop="15" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="287" fromTop="11" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="471" fromTop="19" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="611" fromTop="23" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:TaskListFactory.cs" caret="825" fromTop="31" />
+ <File id="549AF59A-6673-4CB1-A1BD-A68F40C288A6/f:SimpleTaskList.cs" caret="1653" fromTop="17" />
+ </RecentEdits>
+ </RecentFiles>
+ <NAntValidationSettings>
+ <NAntPath value="" />
+ </NAntValidationSettings>
+ <UnitTestRunner>
+ <Providers />
+ </UnitTestRunner>
+ <UnitTestRunnerNUnit>
+ <NUnitInstallDir IsNull="False">
+ </NUnitInstallDir>
+ <UseAddins>Never</UseAddins>
+ </UnitTestRunnerNUnit>
+ <CompletionStatisticsManager>
+ <ItemStatistics item="Default">
+ <Item value="public" priority="7" />
+ <Item value="void" priority="3" />
+ <Item value="using" priority="2" />
+ <Item value="Ninject" priority="1" />
+ <Item value="new" priority="8" />
+ <Item value="ApplicationException`0" priority="1" />
+ <Item value="ITaskList`0" priority="4" />
+ <Item value="Exception`0" priority="1" />
+ <Item value="Assert`0" priority="1" />
+ <Item value="typeof" priority="1" />
+ <Item value="t" priority="4" />
+ <Item value="simpleTaskList" priority="0" />
+ <Item value="Task`0" priority="0" />
+ <Item value="prop" priority="1" />
+ <Item value="Int64`0" priority="3" />
+ <Item value="System" priority="0" />
+ <Item value="Net" priority="0" />
+ <Item value="Sockets" priority="0" />
+ <Item value="IPAddress`0" priority="0" />
+ <Item value="TaskItem`0" priority="4" />
+ <Item value="taskItem" priority="1" />
+ <Item value="string" priority="0" />
+ <Item value="private" priority="2" />
+ <Item value="TaskItem" priority="0" />
+ <Item value="List" priority="0" />
+ <Item value="List&lt;TaskItem&gt;" priority="0" />
+ <Item value="return" priority="5" />
+ <Item value="if" priority="5" />
+ <Item value="taskItems" priority="1" />
+ <Item value="Convert`0" priority="0" />
+ <Item value="taskID" priority="0" />
+ <Item value="else" priority="2" />
+ <Item value="throw" priority="2" />
+ <Item value="AbandonedMutexException" priority="0" />
+ <Item value="ID" priority="1" />
+ <Item value="Details" priority="0" />
+ <Item value="ApplicationException" priority="1" />
+ <Item value="null" priority="1" />
+ <Item value="AppDomainUnloadedException" priority="0" />
+ <Item value="int" priority="0" />
+ <Item value="long" priority="0" />
+ <Item value="static" priority="1" />
+ <Item value="IKernel`0" priority="0" />
+ <Item value="kernel" priority="0" />
+ <Item value="SimpleTaskList`0" priority="0" />
+ <Item value="Console`0" priority="0" />
+ <Item value="override" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:@NUnit.Framework.Assert">
+ <Item value="IsTrue`0" priority="2" />
+ <Item value="AreEqual`0" priority="4" />
+ <Item value="Throws`1" priority="0" />
+ <Item value="That`0" priority="1" />
+ <Item value="IsNotNullOrEmpty`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:Ninject.IKernel">
+ <Item value="Dispose`0" priority="0" />
+ <Item value="Bind`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:System.Collections.Generic.List`1">
+ <Item value="Add`0" priority="0" />
+ <Item value="Find`0" priority="0" />
+ <Item value="Count" priority="1" />
+ <Item value="IndexOf`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:WhatNEXT.TaskItem">
+ <Item value="ID" priority="1" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:@System.Convert">
+ <Item value="ToInt64`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:System.Int64">
+ <Item value="ToString`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:Ninject.Syntax.IBindingToSyntax`1">
+ <Item value="ToMethod`0" priority="0" />
+ <Item value="To`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:@WhatNEXT.TaskListFactory">
+ <Item value="GetInstance`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:WhatNEXT.TaskListFactory">
+ <Item value="CreateList`0" priority="0" />
+ </ItemStatistics>
+ <ItemStatistics item="Qualified:@System.Console">
+ <Item value="WriteLine`0" priority="0" />
+ </ItemStatistics>
+ </CompletionStatisticsManager>
+</Configuration>
View
38 WhatNEXT/WhatNEXT/WhatNEXT.csproj
@@ -23,6 +23,10 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+<<<<<<< HEAD
+=======
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+>>>>>>> upstream/master
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
@@ -33,7 +37,18 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+<<<<<<< HEAD
<ItemGroup>
+=======
+ <PropertyGroup>
+ <StartupObject>WhatNEXT.TaskEventGenerator</StartupObject>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>NinjectBinaries\Ninject.dll</HintPath>
+ </Reference>
+>>>>>>> upstream/master
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -43,11 +58,34 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+<<<<<<< HEAD
<Compile Include="ITaskList.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimpleTaskList.cs" />
<Compile Include="TaskItem.cs" />
+=======
+ <Compile Include="ConsoleTaskEventNotifier.cs" />
+ <Compile Include="Enums.cs" />
+ <Compile Include="ITaskListWithEvents.cs" />
+ <Compile Include="TaskAddEventArgs.cs" />
+ <Compile Include="TaskDelegates.cs" />
+ <Compile Include="TaskEventGenerator.cs" />
+ <Compile Include="Utility.cs" />
+ <Compile Include="ITaskList.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SimpleTaskList.cs" />
+ <Compile Include="TaskItem.cs" />
+ <Compile Include="TaskListFactory.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="NinjectBinaries\extensions\CommonServiceLocator.NinjectAdapter.dll" />
+ <Content Include="NinjectBinaries\extensions\CommonServiceLocator.NinjectAdapter.pdb" />
+ <Content Include="NinjectBinaries\LICENSE.txt" />
+ <Content Include="NinjectBinaries\Ninject.dll" />
+ <Content Include="NinjectBinaries\Ninject.pdb" />
+ <Content Include="NinjectBinaries\Ninject.xml" />
+>>>>>>> upstream/master
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
BIN WhatNEXT/WhatNEXT/WhatNEXT.suo
Binary file not shown.
View
144 WhatNEXTTests/WhatNEXT.Tests/SimpleTaskListTests.cs
@@ -1,8 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
+<<<<<<< HEAD
using System.Text;
using NUnit.Framework;
+=======
+using System.Net;
+using System.Reflection;
+using System.Text;
+using NUnit.Framework;
+using NUnit;
+using NUnit.ConsoleRunner;
+using System.IO;
+
+
+
+>>>>>>> upstream/master
using Ninject;
using WhatNEXT;
@@ -22,7 +35,11 @@ public void AddSingleTask()
list.AddTask(new TaskItem() { ID = 1});
+<<<<<<< HEAD
Assert.AreEqual(simpleTaskList.GetCount(), 1);
+=======
+ Assert.AreEqual(list.GetCount(), 1);
+>>>>>>> upstream/master
}
[Test]
@@ -33,7 +50,24 @@ public void AddDualTask()
list.AddTask(new TaskItem() { ID = 1 });
list.AddTask(new TaskItem() { ID = 2 });
+<<<<<<< HEAD
Assert.AreEqual(simpleTaskList.GetCount(), 2);
+=======
+ Assert.AreEqual(list.GetCount(), 2);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ApplicationException))]
+ public void AddExistingTask()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.AddTask(new TaskItem() { ID = 1 });
+
+ Assert.Throws<ApplicationException>(() => { throw new ApplicationException(); });
+
+>>>>>>> upstream/master
}
[Test]
@@ -43,7 +77,11 @@ public void FindTaskByID()
list.AddTask(new TaskItem() { ID = 1 });
+<<<<<<< HEAD
TaskItem t = simpleTaskList.FindTaskByID(1);
+=======
+ TaskItem t = list.FindTaskByID(1);
+>>>>>>> upstream/master
Assert.IsTrue(t.ID == 1);
}
@@ -51,12 +89,20 @@ public void FindTaskByID()
[Test]
public void UpdateTask()
{
+<<<<<<< HEAD
ITaskList list = TaskListFactory.GetInstance().CreateList();
list.AddTask(new TaskItem() { ID = 1 });
TaskItem taskBeforeUpdate = simpleTaskList.FindTaskByID(1);
simpleTaskList.UpdateTask(new TaskItem() { ID = 1, Details = "Updated Task Details" });
TaskItem taskAfterUpdate = simpleTaskList.FindTaskByID(1);
+=======
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ TaskItem taskBeforeUpdate = list.FindTaskByID(1);
+ list.UpdateTask(new TaskItem() { ID = 1, Details = "Updated Task Details" });
+ TaskItem taskAfterUpdate = list.FindTaskByID(1);
+>>>>>>> upstream/master
Assert.AreNotEqual(taskBeforeUpdate.Details, taskAfterUpdate.Details);
}
@@ -66,10 +112,16 @@ public void UpdateTask()
[ExpectedException(typeof(ApplicationException))]
public void UpdateTask_To_TaskListWithZeroTasks_ThrowsTaskDoesNotExistException()
{
+<<<<<<< HEAD
list.AddTask(new TaskItem() { ID = 1 });
list.UpdateTask(new TaskItem() { ID = 1000 });
+=======
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.UpdateTask(new TaskItem() { ID = 1000 });
+>>>>>>> upstream/master
Assert.Throws<ApplicationException>(() => { throw new ApplicationException(); });
}
@@ -78,6 +130,7 @@ public void UpdateTask_To_TaskListWithZeroTasks_ThrowsTaskDoesNotExistException(
[ExpectedException(typeof(ApplicationException))]
public void UpdateTask_To_TaskListWithOneOrMoreTasks_TaskIDDoesNotExist_ThrowsTaskDoesNotExistException()
{
+<<<<<<< HEAD
var simpleTaskList = kernel.Get<ITaskList>();
@@ -92,4 +145,95 @@ public void TearDown()
kernel.Dispose();
}
}
+=======
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.UpdateTask(new TaskItem() { ID = 1001 });
+ Assert.Throws<ApplicationException>(() => { throw new ApplicationException(); });
+ }
+
+
+ [Test]
+ public void DeleteTask()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.DeleteTask(new TaskItem(){ID = 1});
+ Assert.IsTrue(list.GetCount() == 0);
+ }
+
+ [Test]
+ public void DeleteMultipleTasks()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.AddTask(new TaskItem() { ID = 2 });
+ list.AddTask(new TaskItem() { ID = 3 });
+ list.DeleteTask(new TaskItem() { ID = 2 });
+ list.DeleteTask(new TaskItem() { ID = 3 });
+ Assert.IsTrue(list.GetCount() == 1);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ApplicationException))]
+ public void DeleteInvalidTask()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.DeleteTask(new TaskItem() { ID = 10 });
+ Assert.Throws<ApplicationException>(() => { throw new ApplicationException(); });
+
+ }
+
+
+ [Test]
+ public void GetTasksList()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1 });
+ list.AddTask(new TaskItem() { ID = 2 });
+ list.AddTask(new TaskItem() { ID = 3 });
+
+ Assert.AreEqual(list.GetAll(), 3);
+ }
+
+ [Test]
+ public void ExportTasks()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1, Details = "Task one details"});
+ list.AddTask(new TaskItem() { ID = 2, Details = "Task one details" });
+ list.AddTask(new TaskItem() { ID = 3, Details = "Task one details" });//TODO: Check with IP address
+
+
+ Assert.IsTrue(list.ExportTask(list.GetAll(), Enumerations.ContentType.XML).GetType()==typeof(byte[]));
+ Assert.IsTrue(list.ExportTask(list.GetAll(), Enumerations.ContentType.XML).Length > 0);
+ }
+
+ [Test]
+ public void ExportTasksToXML()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+ list.AddTask(new TaskItem() { ID = 1, Details = "Task one details" });
+ list.AddTask(new TaskItem() { ID = 2, Details = "Task one details" });
+ list.AddTask(new TaskItem() { ID = 3, Details = "Task one details" });//TODO: Check with IP address
+
+
+ byte[] buffer = list.ExportTask(list.GetAll(), Enumerations.ContentType.XML);
+ using (Stream s = new FileStream ("test.xml", FileMode.Create))
+ {
+ s.Write(buffer, 0, buffer.Length);
+
+ }
+ }
+
+ //public static void Main(string[] args)
+ //{
+ // NUnit.ConsoleRunner.Runner.Main();
+
+ //}
+ }
+
+
+
+>>>>>>> upstream/master
}
View
34 WhatNEXTTests/WhatNEXT.Tests/TaskEventGeneratorTests.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using System.Text;
+using NUnit.Framework;
+using NUnit;
+using NUnit.ConsoleRunner;
+using System.IO;
+using Ninject;
+using WhatNEXT;
+
+namespace WhatNEXT.Tests
+{
+ [TestFixture]
+ public class TaskEventGeneratorTests
+ {
+ [Test]
+ public void TestAddTaskEvent()
+ {
+ ITaskList list = TaskListFactory.GetInstance().CreateList();
+
+ ((ITaskListWithEvents)list).Add +=
+ delegate(object sender, TaskAddEventArgs e)
+ {
+ Console.WriteLine("event fired intest cse");
+ Assert.AreEqual(e.TaskID, 1);
+
+ };
+ list.AddTask(new TaskItem() { ID = 1 });
+ }
+ }
+}
View
16 WhatNEXTTests/WhatNEXT.Tests/WhatNEXT.Tests.csproj
@@ -30,10 +30,22 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+<<<<<<< HEAD
+=======
+ <PropertyGroup>
+ <StartupObject />
+ </PropertyGroup>
+>>>>>>> upstream/master
<ItemGroup>
<Reference Include="Ninject">
<HintPath>..\..\WhatNEXT\NInjectBinaries\Ninject.dll</HintPath>
</Reference>
+<<<<<<< HEAD
+=======
+ <Reference Include="nunit-console-runner">
+ <HintPath>..\..\WhatNEXT\NunitBinaries\lib\nunit-console-runner.dll</HintPath>
+ </Reference>
+>>>>>>> upstream/master
<Reference Include="nunit.framework">
<HintPath>..\..\WhatNEXT\NunitBinaries\framework\nunit.framework.dll</HintPath>
</Reference>
@@ -48,6 +60,10 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimpleTaskListTests.cs" />
+<<<<<<< HEAD
+=======
+ <Compile Include="TaskEventGeneratorTests.cs" />
+>>>>>>> upstream/master
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\WhatNEXT\WhatNEXT\WhatNEXT.csproj">

0 comments on commit 2388266

Please sign in to comment.
Something went wrong with that request. Please try again.