This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private bool IsValidReturnUrl(string returnUrl, HostString host) | |
| { | |
| if (Uri.TryCreate(returnUrl, UriKind.RelativeOrAbsolute, out var uri)) | |
| { | |
| // Check if the URL is absolute and has the same host as the current request. | |
| if (uri.IsAbsoluteUri && uri.Host.Equals(host.Host, StringComparison.OrdinalIgnoreCase)) | |
| { | |
| return true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyApplicationExceptionTests | |
| { | |
| [Fact] | |
| public void Constructor_SerializationInfoAndStreamingContext_SetProperties() | |
| { | |
| // Arrange | |
| var message = "Test exception message"; | |
| var innerException = new Exception("Inner exception message"); | |
| // Create SerializationInfo and StreamingContext objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Authentication; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Logging; | |
| using Microsoft.Extensions.Options; | |
| using Moq; | |
| using System.Security.Claims; | |
| using System.Text.Encodings.Web; | |
| using System.Threading.Tasks; | |
| using Xunit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private InputBinding CreateMouseClickInputBinding(Cell cell) | |
| { | |
| InputBinding cellTextBlockInputBinding = new InputBinding( | |
| generationViewModel.ToggleCellLifeCommand, | |
| new MouseGesture(MouseAction.LeftClick) | |
| ); | |
| cellTextBlockInputBinding.CommandParameter = | |
| string.Format("{0},{1}", cell.Row, cell.Column); | |
| return cellTextBlockInputBinding; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public RelayCommand<object> EvolveCommand { get; private set; } | |
| public RelayCommand<object> ResetCommand { get; private set; } | |
| public RelayCommand<string> ToggleCellLifeCommand { get; private set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LifeToColourConverter : IValueConverter | |
| { | |
| public SolidColorBrush AliveColour { get; private set; } | |
| public SolidColorBrush DeadColour { get; private set; } | |
| public LifeToColourConverter(SolidColorBrush aliveColour, | |
| SolidColorBrush deadColour) | |
| { | |
| AliveColour = aliveColour; | |
| DeadColour = deadColour; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Cell : ObservableBase | |
| { | |
| public int Row { get; private set; } | |
| public int Column { get; private set; } | |
| private bool alive; | |
| public bool Alive | |
| { | |
| get { return alive; } | |
| set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ObservableBase : INotifyPropertyChanged | |
| { | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| protected void OnPropertyChanged([CallerMemberName] string memberName = "") | |
| { | |
| if (PropertyChanged != null) | |
| { | |
| PropertyChanged( | |
| this, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Binding CreateCellAliveBinding() | |
| { | |
| return new Binding | |
| { | |
| Path = new PropertyPath("Alive"), | |
| Mode = BindingMode.TwoWay, | |
| Converter = new LifeToColourConverter( | |
| aliveColour: Brushes.Black, | |
| deadColour: Brushes.White | |
| ) |
NewerOlder