Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Party Task - L.Aleksa #36

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e0c0d2c
Initial structure of MVMM
specown Dec 15, 2019
3d8f829
Added fonts
specown Dec 15, 2019
a64e00b
Created event model
specown Dec 15, 2019
b83fd02
Created models for data
specown Dec 15, 2019
bfe89b0
Added main images for login view
specown Dec 15, 2019
f216ee3
Created styling xaml files to be reused
specown Dec 15, 2019
9a6e48a
Main structure of shell view model
specown Dec 15, 2019
c12a27a
Added resource dictionaries to app xaml
specown Dec 15, 2019
3c5b1d4
added configuration for bootstrapper
specown Dec 15, 2019
9f181df
initial base of the solution
specown Dec 15, 2019
56d202e
created main shell view
specown Dec 15, 2019
8e0e9cb
Added logo and two input fields for username and password
specown Dec 15, 2019
7e0e247
Created base of login view model to get typed in username and password
specown Dec 15, 2019
802982b
Added interfaces for helpers
specown Dec 17, 2019
4de1e34
Created helper classes to retrieve data and pass it to endpoint
specown Dec 17, 2019
b7817e0
created models to store user data and retrieved token
specown Dec 17, 2019
6e50e89
changed the structure of interface
specown Dec 17, 2019
7716027
added two new images for server list
specown Dec 17, 2019
14509f8
initial login view structure
specown Dec 17, 2019
edde373
added interfaces to container
specown Dec 17, 2019
0bc8b8b
added app setting for servers
specown Dec 17, 2019
7bc928c
added retrieve servers method
specown Dec 18, 2019
48c7f6e
added exception handling
specown Dec 22, 2019
82e9d71
added exception handling
specown Dec 22, 2019
f56f4dc
changed interface structure
specown Dec 22, 2019
fce6488
added debug logger
specown Dec 22, 2019
a266dc4
additional resources put into dictionaries
specown Dec 22, 2019
a22ac8e
added error message and tidied up the code
specown Dec 22, 2019
9986149
added exception handling
specown Dec 22, 2019
8f44b12
added Ioc for logout
specown Dec 22, 2019
f680495
view changes according to requirements
specown Dec 22, 2019
9d409af
added server path to app config
specown Dec 22, 2019
32ee164
added scroll viewer styling to xaml to be consumed in whole project
specown Dec 22, 2019
6fceb82
added logging
specown Dec 22, 2019
3c63bde
added tests project
specown Dec 22, 2019
0b6aeb7
changed password input
specown Dec 22, 2019
5439437
changes to project
specown Dec 22, 2019
cf16d20
changed from public to internal
specown Dec 22, 2019
475b309
added assemblyinfo to make internal classes visible for tests
specown Dec 22, 2019
d5525fa
Added tests
specown Dec 22, 2019
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
261 changes: 261 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
31 changes: 31 additions & 0 deletions WindowsParty.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.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsParty", "src\WindowsParty\WindowsParty.csproj", "{FE464F23-372C-4FBB-9E59-0020C6A68F64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsParty.Tests", "src\WindowsParty.Tests\WindowsParty.Tests.csproj", "{32D72EC9-18EE-49FB-AD3C-9FB5B38868D5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FE464F23-372C-4FBB-9E59-0020C6A68F64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE464F23-372C-4FBB-9E59-0020C6A68F64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE464F23-372C-4FBB-9E59-0020C6A68F64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE464F23-372C-4FBB-9E59-0020C6A68F64}.Release|Any CPU.Build.0 = Release|Any CPU
{32D72EC9-18EE-49FB-AD3C-9FB5B38868D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32D72EC9-18EE-49FB-AD3C-9FB5B38868D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32D72EC9-18EE-49FB-AD3C-9FB5B38868D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32D72EC9-18EE-49FB-AD3C-9FB5B38868D5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A694B48D-E45A-4339-B256-BC2C0A8E0A2A}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions src/WindowsParty.Tests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="baseUrl" value="http://playground.tesonet.lt/v1/"/>
<add key="tokenPath" value="tokens"/>
<add key="serverPath" value="servers"/>
</appSettings>
</configuration>
80 changes: 80 additions & 0 deletions src/WindowsParty.Tests/LoginViewTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NUnit.Framework;
using WindowsParty.Interfaces;
using Caliburn.Micro;
using WindowsParty.ViewModels;
using WindowsParty.Models;
using AutoFixture;
using System.Threading.Tasks;
using Assert = NUnit.Framework.Assert;

namespace WindowsParty.Tests
{
[TestClass]
public class LoginViewTests
{
private Mock<IAuthenticationHelper> _authenticationHelper;
private Mock<IEventAggregator> _eventAggregator;
private AuthModel _authModel;
private LoginViewModel _loginViewModel;

[TestInitialize]
public void Setup()
{
_authenticationHelper = new Mock<IAuthenticationHelper>();
_eventAggregator = new Mock<IEventAggregator>();

_authModel = new AuthModel()
{
AuthToken = "f9731b590611a5a9377fbd02f247fcdf"
};

_authenticationHelper.Setup(x => x.AuthenticateUser(It.IsAny<UserModel>())).ReturnsAsync(_authModel);

_loginViewModel = new LoginViewModel(_eventAggregator.Object, _authenticationHelper.Object);
}

[TestMethod]
public async Task TokenIsMapped()
{
var fixture = new Fixture();

UserModel _userModel = fixture.Create<UserModel>();

_loginViewModel.Username = _userModel.Username;
_loginViewModel.Password = _userModel.Password;

await _loginViewModel.AuthUser();

Assert.AreEqual(_authModel, _loginViewModel.AuthModel);
}

[TestMethod]
public void InvalidInputLength_Username()
{
var fixture = new Fixture();

UserModel _userModel = fixture.Create<UserModel>();

_loginViewModel.Username = "";
_loginViewModel.Password = _userModel.Password;

Assert.AreEqual(false, _loginViewModel.validateInput());
}

[TestMethod]
public void ValidInputLength_Username()
{
var fixture = new Fixture();

UserModel _userModel = fixture.Create<UserModel>();

_loginViewModel.Username = _userModel.Username;
_loginViewModel.Password = _userModel.Password;

Assert.AreEqual(true, _loginViewModel.validateInput());
}
}
}
Loading