Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Nicolebranch #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,038 changes: 1,038 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added .vs/myBlog/v14/.suo
Binary file not shown.
24 changes: 24 additions & 0 deletions create_micro_blg_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
USE [YOUR DATABASE]
GO

/****** Object: Table [dbo].[MicroBlog] Script Date: 10/18/2016 11:22:28 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MicroBlog](
[CommentID] [int] IDENTITY(1,1) NOT NULL,
[CommentUserName] [nvarchar](50) NOT NULL,
[CommentText] [nvarchar](140) NOT NULL,
[CommentPostDate] [datetime] NOT NULL,
CONSTRAINT [PK_MicroBlog] PRIMARY KEY CLUSTERED
(
[CommentID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


26 changes: 26 additions & 0 deletions myBlog.Tests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Note: Add entries to the App.config file for configuration settings
that apply only to the Test project.
-->
<configuration>
<appSettings>

</appSettings>

<connectionStrings>

</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
77 changes: 77 additions & 0 deletions myBlog.Tests/Controllers/HomeControllerTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using myBlog;
using myBlog.Controllers;
using static myBlog.Models.BlogModel;
using myBlog.Models;


namespace myBlog.Tests.Controllers
{
[TestClass]
public class HomeControllerTest : Controller
{
[TestMethod]
public void TestIndex() //I have never done a unit test before I promise I will get better at it!
{
// Arrange
HomeController controller = new HomeController();

// Act
var result = controller.Index() as ViewResult;

// Assert
Assert.AreEqual("Index", result.ViewName);

}
[TestMethod]
public void TestPostComment()
{
// Arrange
HomeController controller = new HomeController();

// Act
CommentMD md = new CommentMD();
var result = controller.PostComment(md) as ViewResult;

// Assert
Assert.AreEqual("Index", result.ViewName);
}

[TestMethod]
public void TestPostCommentValidation()
{

HomeController controller = new HomeController();
controller.ModelState.Clear();

var comment = new CommentMD
{
CommentID = 1,
CommentPostDate = DateTime.Now,
CommentText = "Hello!",
CommentUserName = "Nicole"
};

ActionResult result = controller.PostComment(comment);
Assert.IsTrue(controller.ModelState.IsValid, "Not valid");
}
[TestMethod]
public void TestAddComment()
{
// Arrange
HomeController controller = new HomeController();

// Act
var result = controller.AddComment() as ViewResult;

// Assert
Assert.AreEqual("AddComment", result.ViewName);
}

}
}
35 changes: 35 additions & 0 deletions myBlog.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("myBlog.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("myBlog.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("de7d83e5-c2d8-472d-b1be-53ba3650f4b2")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file added myBlog.Tests/bin/Debug/EntityFramework.dll
Binary file not shown.
Loading