Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a2250ef
classwork and brainstorming
EddieCrochet Oct 12, 2018
5c68b89
Well hell, I made changes to the prework for lesson 02, switched bra…
EddieCrochet Oct 16, 2018
390496d
Got my Checkpoint1 app started
EddieCrochet Oct 28, 2018
bf83e72
added my repository
EddieCrochet Oct 28, 2018
e31adf7
added my customerController
EddieCrochet Oct 28, 2018
fad68cf
Tutoring helps
EddieCrochet Oct 28, 2018
b8dc8de
making progress on the checkpoint - got create and delete working for…
EddieCrochet Oct 30, 2018
f56026a
Got my Appointment controller to create and dlete objects as well thr…
EddieCrochet Oct 30, 2018
7cafc2a
some more working at getting the objects to basically communicate wit…
EddieCrochet Oct 30, 2018
356a17e
Trying to get my date compare method working
EddieCrochet Nov 2, 2018
b0b1877
Added more functionanality to the appointment controller and repository
EddieCrochet Nov 2, 2018
7ffc605
Im pretty much done but I can NOT figure out how to implement my meth…
EddieCrochet Nov 5, 2018
156fd66
not exactly sure what these changes were... possible last touches
EddieCrochet Nov 18, 2018
f76d0ce
minor changes while trying to improve the application
EddieCrochet Nov 25, 2018
3bc1b2d
Tutoring is awesome, Matt rules! I got my GetProviderByDay or whateve…
EddieCrochet Nov 25, 2018
5802072
Dan showed me the baby steps way to do this assignment so I will star…
EddieCrochet Nov 30, 2018
5db7547
idk
EddieCrochet Nov 30, 2018
80082a5
Still trying to get the database connected - starting with removing t…
EddieCrochet Dec 1, 2018
b7d418b
Redesigning the repo to be able to work with sql
EddieCrochet Dec 2, 2018
523bf60
Forgot to commmit a change LOL
EddieCrochet Dec 2, 2018
26cc167
switching branches to compare again
EddieCrochet Dec 2, 2018
d5caa74
still working on connecting with my database
EddieCrochet Dec 2, 2018
95de4cd
Trying to reference again
EddieCrochet Dec 2, 2018
2fa3336
Still referencing
EddieCrochet Dec 3, 2018
b210a6a
Made some progress
EddieCrochet Dec 3, 2018
96d249f
changing repos and controllers to be able to handle sql
EddieCrochet Dec 4, 2018
06ac2ba
Referencing another project again
EddieCrochet Dec 4, 2018
1117b89
Trying to get my unit tests to work now
EddieCrochet Dec 4, 2018
2b89400
Working on getting successful views
EddieCrochet Dec 5, 2018
3c927e5
Gonna pound this out tonight!
EddieCrochet Dec 5, 2018
3d1a7ae
Still doing my best!
EddieCrochet Dec 6, 2018
081778e
Still same...
EddieCrochet Dec 6, 2018
22d1bb5
Well I got a successful basic build using the Entity framework!
EddieCrochet Dec 7, 2018
8884cb8
I BELIEVE IHAVE ACQUIRED COMPLETE BUILD AND FUNCTIONALITY!!! Now all …
EddieCrochet Dec 9, 2018
de7e88e
Working on MOQ and unit testing
EddieCrochet Dec 9, 2018
7578b29
Still trying to get my tests down - the repositories are tough
EddieCrochet Dec 10, 2018
36c51fc
Set up checkpoint3 project
EddieCrochet Dec 13, 2018
f9966dc
changed the dependency injection to take the interface repo and fixed…
EddieCrochet Mar 26, 2019
a5374f7
fixed the irepo in this project solution file as well.
EddieCrochet Mar 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
using SpaAppointment.Controllers;
using SpaAppointment.Models;
using System.Collections.Generic;
using Xunit;

namespace SpaAppointment.Tests
{
public class AppointmentControllerTest
{
[Fact]
public void CanAppointmentControllerCreate()
{
//arrange
var controller = new AppointmentController();
var testApp = new Appointment();

//act
var result = controller.Create(testApp);

//assert
Assert.NotNull(testApp);
Assert.IsType<RedirectToActionResult>(result);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using SpaAppointment.Models;
using SpaAppointment.Services;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
using System.Linq;

namespace SpaAppointment.Tests
{
public class AppointmentRepositoryTest
{
[Fact]
public void CanAppointmentRepositoryCreate()
{
// arrange
var testAppt = new Appointment()
{ };

//act
AppointmentRepository.Add(testAppt);

// assert
var a = AppointmentRepository.Appointments.FirstOrDefault(x => x.Id == testAppt.Id);
Assert.NotNull(a);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
using SpaAppointment.Controllers;
using SpaAppointment.Models;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace SpaAppointment.Tests
{
public class CustomerControllerTest
{
[Fact]
public void CanCustomerControllerReturnIndexView()
{
//arrange
var controller = new CustomerController();

//act
var result = controller.Index();

//assert
Assert.IsType<ViewResult>(result);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using SpaAppointment.Models;
using SpaAppointment.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace SpaAppointment.Tests
{
public class CustomerRepositoryTest
{
[Fact]
public void CanCustomerRepositoryGetCustomer()
{
//arrange
var testCustomer = new Customer()
{
Name = "Jay Winn",
Id = 10
};

//act
CustomerRepository.Add(testCustomer);

//assert
var c = CustomerRepository.GetCustomer(testCustomer.Id);
Assert.NotNull(c);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Mvc;
using SpaAppointment.Controllers;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace SpaAppointment.Tests
{
public class HomeControllerTest
{
[Fact]
public void CanHomeControllerReturnPrivacyView()
{
//arrange
var controller = new HomeController();

//act
var result = controller.Privacy();

//assert
Assert.IsType<ViewResult>(result);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using SpaAppointment.Controllers;
using SpaAppointment.Models;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace SpaAppointment.Tests
{
public class ServiceProviderControllerTest
{
[Fact]
public void CanServiceProviderControllerViewDetails()
{
//arrange
var controller = new ServiceProviderController();
var testProvider = new ServiceProvider();

//act
var result = controller.Details(testProvider.Id);

//assert
Assert.IsType<ViewResult>(result);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using SpaAppointment.Models;
using SpaAppointment.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace SpaAppointment.Tests
{
public class ServiceProviderRepositoryTest
{
[Fact]
public void CanServiceProviderRepositoryDeleteProvider()
{
//arrange
var testProvider = new ServiceProvider()
{
Id = 10,
Name = "NoHands McGee"
};

//act
ServiceProviderRepository.Add(testProvider);
ServiceProviderRepository.DeleteProvider(testProvider.Id);

//assert
var p = ServiceProviderRepository.Providers.FirstOrDefault(x => x.Id == testProvider.Id);
Assert.Null(p);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SpaAppointment\SpaAppointment.csproj" />
</ItemGroup>

</Project>
31 changes: 31 additions & 0 deletions Checkpoint1/SpaAppointment/SpaAppointment.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpaAppointment", "SpaAppointment\SpaAppointment.csproj", "{DD2F6B76-48A0-4AD2-9978-E5A1D006856D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaAppointment.Tests", "SpaAppointment.Tests\SpaAppointment.Tests.csproj", "{738339BB-07F2-476F-B544-F0F2D9B8669A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD2F6B76-48A0-4AD2-9978-E5A1D006856D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD2F6B76-48A0-4AD2-9978-E5A1D006856D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD2F6B76-48A0-4AD2-9978-E5A1D006856D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD2F6B76-48A0-4AD2-9978-E5A1D006856D}.Release|Any CPU.Build.0 = Release|Any CPU
{738339BB-07F2-476F-B544-F0F2D9B8669A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{738339BB-07F2-476F-B544-F0F2D9B8669A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{738339BB-07F2-476F-B544-F0F2D9B8669A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{738339BB-07F2-476F-B544-F0F2D9B8669A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0C1B1B55-8E28-44A3-A999-553858D7982A}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SpaAppointment.Models;
using SpaAppointment.Services;

namespace SpaAppointment.Controllers
{
public class AppointmentController : Controller
{
AppointmentRepository repo;

public AppointmentController(AppointmentRepository _repo)
{
repo = _repo;
}

// GET: Appointment
public ActionResult Index()
{
return View(AppointmentRepository.Appointments);
}

// GET: Appointment/Details/5
public ActionResult Details(int id)
{
return View(AppointmentRepository.GetAppointment(id));
}

// GET: Appointment/Create
public ActionResult Create()
{
return View();
}

// POST: Appointment/Create
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(Appointment appointments)
{
try
{
AppointmentRepository.Add(appointments);
repo.isAppointmentAvailable(appointments.AppTime);
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}

// GET: Appointment/Edit/5
public ActionResult Edit(int id)
{
return View(AppointmentRepository.GetAppointment(id));
}

// POST: Appointment/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(int id, Appointment appointment)
{
try
{
// TODO: Add update logic here
AppointmentRepository.Update(id, appointment);
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}

// GET: Appointment/Delete/5
public ActionResult Delete(int id)
{
return View(AppointmentRepository.GetAppointment(id));
}

// POST: Appointment/Delete/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Delete(int id, IFormCollection collection)
{
try
{
// TODO: Add delete logic here
AppointmentRepository.DeleteAppointment(id);
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}
}
}
Loading