<commit_before>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BudgetAnalyser.UnitTest.Reports
{
    [TestClass]
    public class GraphDataTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.Inconclusive();
        }
    }
}<commit_msg>Some tests for GraphData<commit_after>﻿using System;
using BudgetAnalyser.Engine.Reports;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BudgetAnalyser.UnitTest.Reports
{
    [TestClass]
    public class GraphDataTest
    {
        [TestMethod]
        public void GraphMinimumValueShouldReturn0GivenPostiveDataBeginningWithZero()
        {
            Assert.AreEqual(0, Subject.GraphMinimumValue);
        }

        [TestMethod]
        public void GraphMinimumValueShouldReturnMinus20GivenDataWithSmallestValueOfMinus20()
        {
            Series3.PlotsList[2].Amount = -20;
            Assert.AreEqual(-20, Subject.GraphMinimumValue);
        }

        [TestMethod]
        public void VisibleShouldDefaultToTrue()
        {
            Assert.IsTrue(Series1.Visible);
        }

        [TestMethod]
        public void VisibleShouldRaiseChangeEventWhenVisibleChanges()
        {
            bool eventRaised = false;
            Series1.PropertyChanged += (s, e) => eventRaised = true;
            Series1.Visible = false;
            Assert.IsTrue(eventRaised);
        }

        private GraphData Subject { get; set; }

        private SeriesData Series1 { get; set; }

        private SeriesData Series2 { get; set; }

        private SeriesData Series3 { get; set; }

        private DateTime StartDate { get; set; }

        [TestInitialize]
        public void TestInitialise()
        {
            StartDate = new DateTime(2014, 08, 20);
            Subject = new GraphData
            {
                GraphName = "Main Graph Title"
            };

            Series1 = new SeriesData
                {
                    SeriesName = "Series 1",
                    Description = "Series 1 Description",
                };

            Series2 = new SeriesData
            {
                SeriesName = "Series 2",
                Description = "Series 2 Description",
            };

            Series3 = new SeriesData
            {
                SeriesName = "Series 3",
                Description = "Series 3 Description",
            };
            
            Subject.SeriesList.Add(Series1);
            Subject.SeriesList.Add(Series2);
            Subject.SeriesList.Add(Series3);

            int seriesNumber = 0;
            foreach (var series in Subject.SeriesList)
            {
                for (int index = 0; index < 31; index++)
                {
                    series.PlotsList.Add(new DatedGraphPlot { Amount = seriesNumber * 100 * (index + 1), Date = StartDate.AddDays(index) });
                }

                seriesNumber++;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08242876526458616, 'fraction_numerical': 0.01594301221166893, 'mean_word_length': 1.6306868867082962, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2972537', 'n_tokens_mistral': 802, 'n_tokens_neox': 735, 'n_words': 163}