-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLPDataManagerTest.cs
More file actions
71 lines (62 loc) · 2.42 KB
/
Copy pathLPDataManagerTest.cs
File metadata and controls
71 lines (62 loc) · 2.42 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Common.Module.Interface;
using Common.Module.Models;
using Data.Module.Helper;
using FileReader.Module.Interface;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
namespace Data.Module.Test.Provider
{
[TestClass]
public class LPDataManagerTest
{
IFactory<LPDatModel> factory;
IFileReader<LPDatModel> fileReader;
IList<LPDatModel> dataList;
IDataManager<LPDatModel> dataManger;
const string fileNameAndLocation = "C:\\files\\LP_210095893_20150901T011608049";
const string fileType = "CSV";
public LPDataManagerTest()
{
factory = factory = new Factory<LPDatModel>();
fileReader = factory.GetFileReaderInstance(fileType);
this.dataManger = factory.GetDataManagerInstance();
this.dataList = this.fileReader.ReadFileContent(fileNameAndLocation, factory.GetFileReaderDataManagerInstance());
}
[TestMethod]
public void ReaderInstanceShouldBeCreatedTest()
{
var minValue = this.dataManger.GetMedianValue(this.dataList);
Assert.AreEqual(minValue, 26.5);
}
[TestMethod]
public void FindAboveGivenValueTest()
{
var minValue = this.dataManger.GetMedianValue(this.dataList);
var resultList = this.dataManger.FindAboveGivenValue(this.dataList, minValue, 20);
Assert.AreEqual(minValue, 26.5);
Assert.AreEqual(resultList.Count, 212);
}
[TestMethod]
public void FindBelowGivenValueTest()
{
var minValue = this.dataManger.GetMedianValue(this.dataList);
var resultList = this.dataManger.FindBelowGivenValue(this.dataList, minValue, 20);
Assert.AreEqual(minValue, 26.5);
Assert.AreEqual(resultList.Count, 170);
}
[TestMethod]
public void FindAboveAndBelowGivenValueTest()
{
var minValue = this.dataManger.GetMedianValue(this.dataList);
var resultList = this.dataManger.FindAboveAndBelowGivenValue(this.dataList, minValue, 20);
Assert.AreEqual(minValue, 26.5);
Assert.AreEqual(resultList.Count, 382);
}
[TestMethod]
public void FindInvalidDataTest()
{
var resultList = this.dataManger.FindInvalidData(this.dataList);
Assert.AreEqual(resultList.Count, 2);
}
}
}